Skip to content

Comments

feat(minifier): logical assignment with sequential#12957

Merged
graphite-app[bot] merged 1 commit intomainfrom
feat/minifier-logical-assignment-with-sequential
Aug 10, 2025
Merged

feat(minifier): logical assignment with sequential#12957
graphite-app[bot] merged 1 commit intomainfrom
feat/minifier-logical-assignment-with-sequential

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Aug 10, 2025

Compress x || (a, x = 3) into x ||= (a, 3).

refs #8315

@github-actions github-actions bot added A-minifier Area - Minifier C-enhancement Category - New feature or request labels Aug 10, 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.

@sapphi-red sapphi-red marked this pull request as ready for review August 10, 2025 08:33
Copilot AI review requested due to automatic review settings August 10, 2025 08:33
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 implements a minifier optimization to compress logical assignment expressions with sequential expressions. The feature transforms patterns like x || (a, x = 3) into x ||= (a, 3), which reduces code size by using logical assignment operators more effectively.

Key changes:

  • Enhanced logical expression compression to handle sequence expressions containing assignments
  • Added comprehensive test coverage for the new optimization pattern
  • Updated minification benchmarks showing improved compression ratios

Reviewed Changes

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

File Description
tasks/minsize/minsize.snap Updated benchmark results showing improved compression ratios across multiple JavaScript libraries
crates/oxc_minifier/src/peephole/minimize_logical_expression.rs Added logic to handle sequence expressions in logical assignment compression
crates/oxc_minifier/src/peephole/minimize_conditions.rs Added test cases covering the new optimization pattern and edge cases

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 10, 2025

CodSpeed Instrumentation Performance Report

Merging #12957 will not alter performance

Comparing feat/minifier-logical-assignment-with-sequential (577d742) with main (96a1a4f)1

Summary

✅ 34 untouched benchmarks

Footnotes

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

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Aug 10, 2025
Copy link
Member

Boshen commented Aug 10, 2025

Merge activity

Compress `x || (a, x = 3)` into `x ||= (a, 3)`.

refs #8315
@graphite-app graphite-app bot force-pushed the feat/minifier-logical-assignment-with-sequential branch from 386a8c3 to 577d742 Compare August 10, 2025 08:59
@graphite-app graphite-app bot merged commit 577d742 into main Aug 10, 2025
29 checks passed
@graphite-app graphite-app bot deleted the feat/minifier-logical-assignment-with-sequential branch August 10, 2025 09:04
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 10, 2025
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-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants