Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Apr 7, 2025

In these 3 places, we pop a statement from a Vec and insert it elsewhere.

Previously we used take_in_box to get the statement first (which involves allocating a dummy node into arena) and then pop-ed and discarded the dummy. Instead do the pop first, to avoid the unnecessary allocation.

I assume that compiler will see that the unreachable! path is genuinely unreachable because we just checked the type of the statement above, and will elide that check.

@github-actions github-actions bot added A-minifier Area - Minifier C-performance Category - Solution not expected to change functional behavior, only performance labels Apr 7, 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.

@overlookmotel overlookmotel marked this pull request as ready for review April 7, 2025 16:15
@overlookmotel
Copy link
Member Author

(prompted by looking where we're using take_in_box after #10169)

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 7, 2025

CodSpeed Instrumentation Performance Report

Merging #10301 will degrade performances by 3.54%

Comparing 04-07-perf_minifier_reduce_allocations (876b6ea) with main (afe663b)

Summary

⚡ 1 improvements
❌ 1 regressions
✅ 34 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
formatter[antd.js] 7.6 ms 7.9 ms -3.54%
formatter[typescript.js] 7.6 ms 7.2 ms +5.36%

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

Boshen commented Apr 7, 2025

Merge activity

In these 3 places, we `pop` a statement from a `Vec` and insert it elsewhere.

Previously we used `take_in_box` to get the statement first (which involves allocating a dummy node into arena) and then `pop`-ed and discarded the dummy. Instead do the `pop` first, to avoid the unnecessary allocation.

I *assume* that compiler will see that the `unreachable!` path is genuinely unreachable because we just checked the type of the statement above, and will elide that check.
@graphite-app graphite-app bot force-pushed the 04-07-perf_minifier_reduce_allocations branch from 192098d to 876b6ea Compare April 7, 2025 16:20
@graphite-app graphite-app bot merged commit 876b6ea into main Apr 7, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 04-07-perf_minifier_reduce_allocations branch April 7, 2025 16:26
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 7, 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.

3 participants