-
-
Notifications
You must be signed in to change notification settings - Fork 720
feat(minifier): inline single use variables within the same variable declarations #13959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(minifier): inline single use variables within the same variable declarations #13959
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. |
CodSpeed Instrumentation Performance ReportMerging #13959 will degrade performances by 3.59%Comparing Summary
Benchmarks breakdown
Footnotes
|
a2f9787 to
c0cb248
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a peephole optimization to inline single-use variables within the same variable declaration list (e.g., var a = foo, b = a; -> var b = foo;), and refactors internal logic to support reuse across contexts.
- Implement inline-within-declaration optimization and invoke it for standalone var/let/const declarations and for-loop init declarations
- Extract shared logic for substituting single-use symbols from a list of declarators
- Update tests and snapshots to reflect improved minification and allocation/sizing deltas
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tasks/track_memory_allocations/allocs_minifier.snap | Updates memory allocation snapshots reflecting new optimization effects. |
| tasks/minsize/minsize.snap | Updates size metrics snapshots showing slightly improved minification. |
| crates/oxc_minifier/tests/peephole/inline_single_use_variable.rs | Adds tests covering inlining within the same variable declarations, including for-loop init and using/let cases. |
| crates/oxc_minifier/src/peephole/minimize_statements.rs | Implements the inlining within declaration lists, refactors substitution logic into a reusable helper, and wires calls at appropriate transformation points. |
| crates/oxc_minifier/src/peephole/minimize_conditions.rs | Adjusts a test to expect additional constant folding/elimination due to the new optimization. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
c0cb248 to
314fced
Compare
314fced to
08ecae3
Compare
Merge activity
|
36e07f5 to
6d81510
Compare
6d81510 to
03b75ab
Compare
03b75ab to
402e6c7
Compare

Compress
into
refs #13912