Skip to content

Comments

perf(minifier): prealloc template exprs vec#13410

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-29-perf_minifier_prealloc_template_exprs_vec
Sep 3, 2025
Merged

perf(minifier): prealloc template exprs vec#13410
graphite-app[bot] merged 1 commit intomainfrom
08-29-perf_minifier_prealloc_template_exprs_vec

Conversation

@camchenry
Copy link
Member

@camchenry camchenry commented Aug 30, 2025

Small preallocation optimization. Found this mainly to demonstrate that the minifier allocation tracking is working as expected.

@github-actions github-actions bot added A-minifier Area - Minifier C-performance Category - Solution not expected to change functional behavior, only performance labels Aug 30, 2025
Copy link
Member Author

camchenry commented Aug 30, 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 Aug 30, 2025

CodSpeed Instrumentation Performance Report

Merging #13410 will not alter performance

Comparing 08-29-perf_minifier_prealloc_template_exprs_vec (60dd9c9) with main (7e78e39)1

Summary

✅ 37 untouched benchmarks

Footnotes

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

@camchenry camchenry force-pushed the 08-29-perf_minifier_prealloc_template_exprs_vec branch from d4fdfa6 to 5ab6573 Compare August 30, 2025 02:27
@camchenry camchenry force-pushed the 08-29-feat_allocs_track_allocations_for_minifier branch from 294ba18 to 010245a Compare August 30, 2025 02:27
@graphite-app graphite-app bot changed the base branch from 08-29-feat_allocs_track_allocations_for_minifier to graphite-base/13410 August 30, 2025 14:14
@camchenry camchenry force-pushed the 08-29-perf_minifier_prealloc_template_exprs_vec branch from 5ab6573 to 7edfe6b Compare September 2, 2025 21:31
@camchenry camchenry changed the base branch from graphite-base/13410 to main September 2, 2025 21:31
@camchenry camchenry marked this pull request as ready for review September 2, 2025 21:31
Copilot AI review requested due to automatic review settings September 2, 2025 21:31
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 adds a small preallocation optimization to the minifier by preallocating the template expressions vector with the known capacity. The change reduces memory reallocations during template literal processing.

  • Preallocates the expressions vector with expression_count capacity instead of starting with an empty vector

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tasks/track_memory_allocations/allocs_minifier.snap Updates allocation tracking snapshot showing reduced arena reallocations from 70354 to 70117
crates/oxc_minifier/src/peephole/replace_known_methods.rs Preallocates expressions vector with known capacity in template literal optimization

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 3, 2025
Copy link
Member

Boshen commented Sep 3, 2025

Merge activity

Small preallocation optimization. Found this mainly to demonstrate that the minifier allocation tracking is working as expected.
@graphite-app graphite-app bot force-pushed the 08-29-perf_minifier_prealloc_template_exprs_vec branch from 7edfe6b to 60dd9c9 Compare September 3, 2025 00:56
@graphite-app graphite-app bot merged commit 60dd9c9 into main Sep 3, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 08-29-perf_minifier_prealloc_template_exprs_vec branch September 3, 2025 01:01
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 3, 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