Skip to content

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Sep 20, 2025

Compress

var a = foo, b = a;

into

var b = foo;

refs #13912

@github-actions github-actions bot added A-minifier Area - Minifier C-enhancement Category - New feature or request labels Sep 20, 2025
Copy link
Member Author


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.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 20, 2025

CodSpeed Instrumentation Performance Report

Merging #13959 will degrade performances by 3.59%

Comparing 09-20-feat_minifier_inline_single_use_variables_within_the_same_variable_declarations (402e6c7) with main (7e42b0a)

Summary

❌ 1 regression
✅ 32 untouched
⏩ 4 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
minifier[cal.com.tsx] 31.5 ms 32.7 ms -3.59%

Footnotes

  1. 4 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.

@sapphi-red sapphi-red force-pushed the 09-20-feat_minifier_inline_single_use_variables_within_the_same_variable_declarations branch from a2f9787 to c0cb248 Compare September 20, 2025 15:49
@sapphi-red sapphi-red marked this pull request as ready for review September 20, 2025 15:54
Copilot AI review requested due to automatic review settings September 20, 2025 15:54
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

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.

@sapphi-red sapphi-red force-pushed the 09-20-feat_minifier_inline_single_use_variables_within_the_same_variable_declarations branch from c0cb248 to 314fced Compare September 24, 2025 07:27
@Boshen Boshen force-pushed the 09-20-feat_minifier_inline_single_use_variables_within_the_same_variable_declarations branch from 314fced to 08ecae3 Compare September 27, 2025 06:36
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Sep 27, 2025
Copy link
Member

Boshen commented Sep 27, 2025

Merge activity

  • Sep 27, 6:37 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 27, 6:47 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Sep 27, 6:47 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Sep 27, 6:48 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 27, 6:48 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Sep 27, 6:48 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Sep 27, 6:48 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 27, 6:49 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Sep 27, 6:49 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Sep 27, 6:49 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 27, 7:24 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Sep 27, 7:24 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Sep 27, 7:24 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 27, 8:47 AM UTC: Boshen added this pull request to the Graphite merge queue.
  • Sep 27, 8:53 AM UTC: Merged by the Graphite merge queue.

@Boshen Boshen force-pushed the 09-20-feat_minifier_inline_single_use_variables_within_the_same_variable_declarations branch 2 times, most recently from 36e07f5 to 6d81510 Compare September 27, 2025 08:13
@Boshen Boshen force-pushed the 09-20-feat_minifier_inline_single_use_variables_within_the_same_variable_declarations branch from 6d81510 to 03b75ab Compare September 27, 2025 08:42
…declarations (#13959)

Compress
```js
var a = foo, b = a;
```
into
```js
var b = foo;
```
refs #13912
@graphite-app graphite-app bot force-pushed the 09-20-feat_minifier_inline_single_use_variables_within_the_same_variable_declarations branch from 03b75ab to 402e6c7 Compare September 27, 2025 08:48
@graphite-app graphite-app bot merged commit 402e6c7 into main Sep 27, 2025
26 checks passed
@graphite-app graphite-app bot deleted the 09-20-feat_minifier_inline_single_use_variables_within_the_same_variable_declarations branch September 27, 2025 08:53
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants