perf(minifier): use atom_from_strs_array for template literal concat#20386
Merged
graphite-app[bot] merged 1 commit intomainfrom Mar 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes constant-folding for template literals in the minifier by avoiding intermediate String allocations when concatenating template quasi raw/cooked values, instead allocating the final result directly into the arena via atom_from_strs_array.
Changes:
- Replace
to_string()/into_string()+ concatenation withctx.ast.atom_from_strs_array([...])when merging template literal quasis intry_fold_add_op. - Do the same allocation optimization when inlining constant expressions into template literals in
inline_template_literal.
You can also share your feedback on Copilot code review. Take the survey.
Merging this PR will improve performance by 3.49%
Performance Changes
Comparing Footnotes
|
0b4228a to
5c705d8
Compare
Member
Author
Merge activity
|
…20386) ## Summary - Replace 4 instances of heap `String` concatenation with `ctx.ast.atom_from_strs_array()` - Avoids intermediate heap allocations by concatenating directly into the arena allocator - Affects template literal merging and expression inlining into quasis 🤖 Generated with [Claude Code](https://claude.com/claude-code)
55523d1 to
30a2b0f
Compare
camc314
pushed a commit
that referenced
this pull request
Mar 16, 2026
### 🐛 Bug Fixes - edb8677 ecmascript: Treat collection constructor with variable arg as side-effectful (#20383) (Dunqing) - 1f65c3f transformer: Emit design:paramtypes when class has static anonymous class expression (#20382) (bab) - fa70d5c transformer: Use implementation signature for design:paramtypes when constructor is overloaded (#20394) (bab) - ed5a7fb parser: Report syntax error for `new super()` (#20384) (Boshen) - e62524d minifier: Treat object spread of getters as having side effects (#20380) (Boshen) - f8fbd6e linter/plugins: Remove `hashbang` property from AST (#20365) (overlookmotel) ### ⚡ Performance - 30a2b0f minifier: Use atom_from_strs_array for template literal concat (#20386) (Boshen) - 690ce17 minifier: Use Vec::with_capacity for inline template expressions (#20389) (Boshen) - 9cd612f linter/plugins: Recycle comment objects (#20362) (overlookmotel) Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stringconcatenation withctx.ast.atom_from_strs_array()🤖 Generated with Claude Code