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

Micro-optimize push() and insert(). #315

Merged
merged 2 commits into from Sep 20, 2023
Merged

Micro-optimize push() and insert(). #315

merged 2 commits into from Sep 20, 2023

Conversation

@emilio
Copy link
Member Author

emilio commented Sep 20, 2023

r? @mbrubeck

@emilio
Copy link
Member Author

emilio commented Sep 20, 2023

Fixed MSRV, I think.

@emilio
Copy link
Member Author

emilio commented Sep 20, 2023

https://bugzilla.mozilla.org/show_bug.cgi?id=1853969 is the regression this addresses.

// so that the optimizer removes duplicated calls to it
// from callers like insert()
// prefer triple_mut() even if triple() would work so that the optimizer removes duplicated
// calls to it from callers.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So then, does this comment make sense anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially? In code like:

vec.try_reserve(1)?;
vec.push(...);

It might still be useful / let the compiler optimize more.

@mbrubeck mbrubeck merged commit e74e3d5 into master Sep 20, 2023
6 checks passed
@mbrubeck
Copy link
Collaborator

Merged to the v1 branch and published as version 1.11.1.

@emilio emilio deleted the push-microoptimize branch September 20, 2023 19:11
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.

None yet

3 participants