Skip to content

perf(minifier): use Vec::with_capacity for inline template expressions#20389

Merged
graphite-app[bot] merged 1 commit intomainfrom
perf/minifier-inline-exprs-with-capacity
Mar 15, 2026
Merged

perf(minifier): use Vec::with_capacity for inline template expressions#20389
graphite-app[bot] merged 1 commit intomainfrom
perf/minifier-inline-exprs-with-capacity

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Mar 14, 2026

Summary

  • Pre-allocate inline_exprs Vec based on t.expressions.len() to avoid incremental reallocations

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 14, 2026 15:57
@github-actions github-actions bot added A-minifier Area - Minifier C-performance Category - Solution not expected to change functional behavior, only performance labels Mar 14, 2026
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 improves minifier peephole performance by avoiding incremental reallocations when collecting inline-able template literal expressions during constant folding.

Changes:

  • Pre-allocates inline_exprs with Vec::with_capacity(t.expressions.len()) in inline_template_literal.

You can also share your feedback on Copilot code review. Take the survey.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 14, 2026

Merging this PR will not alter performance

✅ 49 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing perf/minifier-inline-exprs-with-capacity (6b4377d) with main (e62524d)

Open in CodSpeed

Footnotes

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

@Boshen Boshen self-assigned this Mar 14, 2026
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Mar 15, 2026
Copy link
Member Author

Boshen commented Mar 15, 2026

Merge activity

#20389)

## Summary
- Pre-allocate `inline_exprs` Vec based on `t.expressions.len()` to avoid incremental reallocations

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@graphite-app graphite-app bot force-pushed the perf/minifier-inline-exprs-with-capacity branch from 6b4377d to 690ce17 Compare March 15, 2026 01:49
@graphite-app graphite-app bot merged commit 690ce17 into main Mar 15, 2026
21 checks passed
@graphite-app graphite-app bot deleted the perf/minifier-inline-exprs-with-capacity branch March 15, 2026 02:00
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 15, 2026
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>
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