perf(minify): skip renaming symbols with zero use count#26234
Closed
perf(minify): skip renaming symbols with zero use count#26234
Conversation
Collaborator
Author
|
Updated 11:23 PM PT - Jan 18th, 2026
❌ Your commit
🧪 To try this PR locally: bunx bun-pr 26234That installs a local version of the PR into your bun-26234 --bun |
Contributor
WalkthroughFrequency-based renaming in Changes
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
6907666 to
ef29867
Compare
In MinifyRenamer, avoid generating names for slots where the symbol use count is zero. These represent declared symbols that are never actually used (e.g., tree-shaken away or declared but not referenced). We filter out zero-count slots before adding to the sorted array, avoiding unnecessary sorting and iteration overhead. This is particularly beneficial when nested scopes are tree-shaken, as their pre-allocated symbol slots would otherwise still be processed. Ported from oxc: oxc-project/oxc#18183 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ef29867 to
ab9ba5b
Compare
Collaborator
|
Could not find a measurable performance difference. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
These slots represent declared symbols in nested scopes that were tree-shaken away. By filtering them out before sorting, we avoid unnecessary name generation work.
Ported from oxc: oxc-project/oxc#18183
Test plan
minify/SkipUnusedSymbolSlotstest that verifies the optimization works when nested scopes are tree-shaken🤖 Generated with Claude Code