perf(allocator): add #[inline(always)] to trivial RawVec methods#15470
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Trivial change, so merging without review. |
Merge activity
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds inline attributes to several methods in RawVec and corrects documentation to accurately reflect the implementation. The changes improve performance by enabling aggressive inlining of simple accessor methods and constructor functions.
- Adds
#[inline(always)]to four simple methods:new_in,from_raw_parts_in,ptr, andbump - Adds
#[inline]to the privatecurrent_layoutmethod - Corrects documentation comment for
ptr()method to referenceNonNull::dangling()instead of the outdatedUnique::empty()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…15470) These methods are trivial, and should always be inlined. Probably compiler will anyway, but make sure by adding `#[inline(always)]` attributes, same as for `RawVec`'s other trivial methods.
7de2fce to
b6f3424
Compare
CodSpeed Performance ReportMerging #15470 will not alter performanceComparing Summary
Footnotes
|

These methods are trivial, and should always be inlined. Probably compiler will anyway, but make sure by adding
#[inline(always)]attributes, same as forRawVec's other trivial methods.