Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: unsafe push_unchecked #58

Open
trueb2 opened this issue Jul 26, 2024 · 0 comments
Open

Feature: unsafe push_unchecked #58

trueb2 opened this issue Jul 26, 2024 · 0 comments

Comments

@trueb2
Copy link

trueb2 commented Jul 26, 2024

I have a µcontroller that suffers with the push's including a branch on the len check (no branch predictor). I would like to reserve sufficient space, then push unchecked to avoid the overhead. I could similarly accomplish my goals with a spare_capacity_mut interface similar to Vec, but that provides slightly different internal data structure control rather than pushing initialized values through a more normal interface.

An Extend interface could benefit from this as well because it uses push internally. The Extend impl change would not resolve my purpose because it would require the overhead of managing state within the Iterator instance, so a pub push_unchecked would be preferred for me.

Would you be open to a PR with an unsafe push_unchecked impl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant