perf(mangler): store slot indexes as u32s#13462
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. |
Merge activity
|
CodSpeed Instrumentation Performance ReportMerging #13462 will improve performances by 6.46%Comparing Summary
Benchmarks breakdown
Footnotes |
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the mangler's slot storage by changing the slot index type from usize to u32. The optimization is based on the fact that there cannot be more slots than symbols, and since SymbolId is already a u32, the slot indexes can safely use the same type without risk of overflow.
Key changes:
- Changed
Slottype alias fromusizetou32 - Added explicit type casts with clippy suppressions where needed
- Moved
sort_unstable()call to after empty check for minor optimization
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
a5345cb to
0d66399
Compare

There cannot be more slots than symbols, and
SymbolIdis au32, so there can't be more thanu32::MAXsymbols. Therefore we can store slot indexes asu32too.