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

Reserve space in Vec::extend() before pushing elements #36

Merged
merged 1 commit into from
Oct 31, 2019

Conversation

andylokandy
Copy link
Contributor

@andylokandy andylokandy commented Oct 30, 2019

Reserve space by size_hint() in Vec::extend() before pushing elements.

@andylokandy andylokandy changed the title Reserve space before Vec::extend() Reserve space in Vec::extend() before pushing elements Oct 30, 2019
@fitzgen
Copy link
Owner

fitzgen commented Oct 30, 2019

Thanks for sending a pull request.

bumpalo::collections::Vec is a fork of std::vec::Vec and I don't really want to get into the business of changing its algorithm and implementation. so unless std::vec::Vec started doing this and we are matching its new behavior, I'd prefer not to diverge.

@TethysSvensson
Copy link
Contributor

As far as I know, standard Vec is using all sorts of specialization magic to optimize it's extend and we are not.

@fitzgen
Copy link
Owner

fitzgen commented Oct 31, 2019

Yeah that's fair.

@fitzgen fitzgen merged commit c0fa76c into fitzgen:master Oct 31, 2019
@andylokandy andylokandy deleted the extend_reserve branch November 1, 2019 09:47
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

Successfully merging this pull request may close these issues.

3 participants