Skip to content

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

Merged
mbrubeck merged 2 commits intomasterfrom
push-microoptimize
Sep 20, 2023
Merged

Micro-optimize push() and insert().#315
mbrubeck merged 2 commits intomasterfrom
push-microoptimize

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.

@emilio emilio requested a review from mbrubeck September 20, 2023 15:40
// 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
@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.

3 participants