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

vec::reserve should reserve the exact amount requested #1753

Closed
brson opened this issue Feb 4, 2012 · 3 comments
Closed

vec::reserve should reserve the exact amount requested #1753

brson opened this issue Feb 4, 2012 · 3 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Feb 4, 2012

This function currently reserves to the next power of two. This makes sense during compiler push operations, but the library function is typically called when the final size of the vector is known. Even when that assumption isn't correct we'll end up allocating to the next power of two on the next push.

@killerswan
Copy link
Contributor

When this change is made, we should try out str::reserve again, too: https://gist.github.com/1661506

@killerswan
Copy link
Contributor

At the moment, due to some unrelated error, I can't build, but this branch shows what I'm thinking will work: killerswan/rust@master...exact_reserve

@brson
Copy link
Contributor Author

brson commented Feb 5, 2012

Fixed by the killerswan

@brson brson closed this as completed Feb 5, 2012
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Fixes a regression introduced by rust-lang#1453. The symtabl2gb prints a lot of debug messages, so we always suppressed the output except when there is an error in its execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants