Skip to content

perf(mangler): avoid ToString allocations#17378

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/12-26-perf_mangler_avoid_tostring_allocations
Dec 27, 2025
Merged

perf(mangler): avoid ToString allocations#17378
graphite-app[bot] merged 1 commit intomainfrom
c/12-26-perf_mangler_avoid_tostring_allocations

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Dec 26, 2025

Screenshot 2025-12-26 at 21 59 08

@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Dec 26, 2025
Copy link
Contributor Author

camc314 commented Dec 26, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@camc314 camc314 self-assigned this Dec 26, 2025
@camc314 camc314 force-pushed the c/12-26-perf_mangler_avoid_tostring_allocations branch from 6869590 to bc4d6fd Compare December 26, 2025 21:53
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 26, 2025

CodSpeed Performance Report

Merging #17378 will not alter performance

Comparing c/12-26-perf_mangler_avoid_tostring_allocations (5d3eb53) with main (d2abc78)1

Summary

✅ 38 untouched
⏩ 7 skipped2

Footnotes

  1. No successful run was found on main (5988dfa) during the generation of this report, so d2abc78 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 marked this pull request as ready for review December 26, 2025 21:59
Copilot AI review requested due to automatic review settings December 26, 2025 21:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.mjs benchmark (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.

@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 27, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the c/12-26-perf_mangler_avoid_tostring_allocations branch from 5d3eb53 to c3ff642 Compare December 27, 2025 05:44
@graphite-app graphite-app bot merged commit c3ff642 into main Dec 27, 2025
20 checks passed
@graphite-app graphite-app bot deleted the c/12-26-perf_mangler_avoid_tostring_allocations branch December 27, 2025 05:51
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants