Skip to content

feat(minifier): evaluate .concat calls that has subsequent method calls#14074

Merged
graphite-app[bot] merged 1 commit intomainfrom
09-24-feat_minifier_evaluate_.concat_calls_that_has_subsequent_method_calls
Sep 25, 2025
Merged

feat(minifier): evaluate .concat calls that has subsequent method calls#14074
graphite-app[bot] merged 1 commit intomainfrom
09-24-feat_minifier_evaluate_.concat_calls_that_has_subsequent_method_calls

Conversation

@sapphi-red
Copy link
Member

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

x = ''.concat('a', ' ').concat('b').split(/[\\s\\n]+/)

was not compressed to

x = 'a b'.split(/[\\s\\n]+/)

. This PR changes the code to allow that.

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

CodSpeed Instrumentation Performance Report

Merging #14074 will not alter performance

Comparing 09-24-feat_minifier_evaluate_.concat_calls_that_has_subsequent_method_calls (1337811) with main (9ea9c38)1

Summary

✅ 33 untouched
⏩ 4 skipped2

Footnotes

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

  2. 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 marked this pull request as ready for review September 24, 2025 10:40
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 enables the minifier to optimize chained .concat() calls when they are followed by other method calls, allowing the concatenation to be evaluated before the subsequent method is applied.

  • Modified the condition that prevents concat optimization when followed by method calls
  • Added test cases to verify the optimization works with subsequent method calls like .join() and .split()

Reviewed Changes

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

File Description
crates/oxc_minifier/src/peephole/replace_known_methods.rs Updated condition to allow concat optimization when followed by non-concat method calls and added comprehensive test cases
tasks/minsize/minsize.snap Updated snapshot reflecting minor size improvement in antd.js
tasks/track_memory_allocations/allocs_minifier.snap Updated memory allocation snapshot with minor changes in cal.com.tsx and antd.js

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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

Boshen commented Sep 25, 2025

Merge activity

…alls (#14074)

```js
x = ''.concat('a', ' ').concat('b').split(/[\\s\\n]+/)
```
was not compressed to
```js
x = 'a b'.split(/[\\s\\n]+/)
```
. This PR changes the code to allow that.
@graphite-app graphite-app bot force-pushed the 09-24-feat_minifier_evaluate_.concat_calls_that_has_subsequent_method_calls branch from e081f92 to 1337811 Compare September 25, 2025 15:31
@graphite-app graphite-app bot merged commit 1337811 into main Sep 25, 2025
26 checks passed
@graphite-app graphite-app bot deleted the 09-24-feat_minifier_evaluate_.concat_calls_that_has_subsequent_method_calls branch September 25, 2025 15:37
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 25, 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