Skip to content

perf(minifier): remove late optimization pass#12670

Merged
graphite-app[bot] merged 1 commit intomainfrom
07-31-perf_minifier_remove_late_optimization_pass
Aug 9, 2025
Merged

perf(minifier): remove late optimization pass#12670
graphite-app[bot] merged 1 commit intomainfrom
07-31-perf_minifier_remove_late_optimization_pass

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Jul 31, 2025

Probably an overkill?

@github-actions github-actions bot added A-minifier Area - Minifier C-performance Category - Solution not expected to change functional behavior, only performance labels Jul 31, 2025
@Boshen Boshen marked this pull request as draft July 31, 2025 11:06
Copy link
Member Author

Boshen commented Jul 31, 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 31, 2025

CodSpeed Instrumentation Performance Report

Merging #12670 will improve performances by 5.98%

Comparing 07-31-perf_minifier_remove_late_optimization_pass (96b4009) with main (e0e835b)1

Summary

⚡ 2 improvements
✅ 32 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
minifier[RadixUIAdoptionSection.jsx] 80.3 µs 75.8 µs +5.98%
minifier[binder.ts] 4.9 ms 4.7 ms +3.87%

Footnotes

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

@Boshen Boshen force-pushed the 07-31-perf_minifier_remove_late_optimization_pass branch from 64cc2f5 to 85aaa66 Compare July 31, 2025 11:28
@Boshen Boshen force-pushed the 07-31-perf_minifier_remove_late_optimization_pass branch from 85aaa66 to 7958e4e Compare August 9, 2025 16:20
@Boshen Boshen marked this pull request as ready for review August 9, 2025 16:27
Copilot AI review requested due to automatic review settings August 9, 2025 16:27
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Aug 9, 2025
Copy link
Member Author

Boshen commented Aug 9, 2025

Merge activity

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 removes the late optimization pass from the minifier, consolidating optimizations into a single pass to simplify the architecture. The change moves several optimization methods from LatePeepholeOptimizations into the main PeepholeOptimizations pass and removes the separate late pass entirely.

  • Removes the LatePeepholeOptimizations struct and its separate traversal pass
  • Moves optimization methods from late pass into the main PeepholeOptimizations implementation
  • Consolidates spread argument removal into the main call/new expression handlers

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/oxc_minifier/src/compressor.rs Removes the late optimization pass call from the compression pipeline
crates/oxc_minifier/src/peephole/mod.rs Eliminates LatePeepholeOptimizations struct and merges its methods into PeepholeOptimizations
crates/oxc_minifier/src/peephole/substitute_alternate_syntax.rs Moves optimization methods from late pass and integrates them into main expression handling
crates/oxc_minifier/src/peephole/remove_dead_code.rs Moves dead code removal method from late pass to main implementation
crates/oxc_minifier/src/peephole/convert_to_dotted_properties.rs Updates implementation to use PeepholeOptimizations instead of LatePeepholeOptimizations

}

impl<'a> LatePeepholeOptimizations {
pub fn remove_dead_code_exit_class_body(body: &mut ClassBody<'a>, _ctx: &mut Ctx<'a, '_>) {
Copy link

Copilot AI Aug 9, 2025

Choose a reason for hiding this comment

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

The method remove_dead_code_exit_class_body should be moved to the PeepholeOptimizations impl block to maintain consistency with the consolidation pattern used elsewhere in this PR.

Suggested change
pub fn remove_dead_code_exit_class_body(body: &mut ClassBody<'a>, _ctx: &mut Ctx<'a, '_>) {
pub fn remove_dead_code_exit_class_body(&self, body: &mut ClassBody<'a>, _ctx: &mut Ctx<'a, '_>) {

Copilot uses AI. Check for mistakes.
@graphite-app graphite-app bot force-pushed the 07-31-perf_minifier_remove_late_optimization_pass branch from 7958e4e to 96b4009 Compare August 9, 2025 16:27
@graphite-app graphite-app bot merged commit 96b4009 into main Aug 9, 2025
29 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 9, 2025
@graphite-app graphite-app bot deleted the 07-31-perf_minifier_remove_late_optimization_pass branch August 9, 2025 16:33
taearls pushed a commit to taearls/oxc that referenced this pull request Aug 12, 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-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