expose expect intrinsics + mark push slow path #17317
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This marks the slow path in the
Vec<T>
push
function, improvidingcode generation by moving it out of fast paths. The
push
function isinlined in countless locations and not all of them order these blocks
appropriately without a hint. This improves the performance of the
microbenchmark in #15177 by 15% when dirty page purging is disabled.
Exposing the i1 version of the intrinsic for
bool
would be useful, butthe quirks of Rust's code generation prevent it from becoming branch
metadata so it has been left out for now.
A more sophisticated approach could be taken in the future (#11092) but
this provides a useful optimization feature today.