perf(mangler): avoid ToString allocations#17378
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. |
6869590 to
bc4d6fd
Compare
CodSpeed Performance ReportMerging #17378 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes the mangler by eliminating unnecessary ToString allocations when counting private class members. The optimization replaces a filter_map that converted element names to strings (only to discard them) with a simpler filter that only checks the is_private flag.
Key Changes:
- Simplified the private member counting logic to avoid allocating strings that are immediately discarded
- Reduced allocations by 302 for
pdf.mjsbenchmark (from 20495 to 20193)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/oxc_mangler/src/lib.rs |
Refactored private member counting to use filter instead of filter_map with to_string(), avoiding unnecessary string allocations |
tasks/track_memory_allocations/allocs_minifier.snap |
Updated allocation benchmark showing reduction from 20495 to 20193 allocations for pdf.mjs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bc4d6fd to
5d3eb53
Compare
Merge activity
|
<img width="701" height="255" alt="Screenshot 2025-12-26 at 21 59 08" src="https://github.com/user-attachments/assets/841bc436-07f1-4579-8e90-7432d2eea4a4" />
5d3eb53 to
c3ff642
Compare

Uh oh!
There was an error while loading. Please reload this page.