Skip to content

perf(mangler)!: Mangler::build_with_semantic take mut ref to Semantic#11132

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-18-perf_mangler_mangler_build_with_semantic_take_mut_ref_to_semantic_
May 19, 2025
Merged

perf(mangler)!: Mangler::build_with_semantic take mut ref to Semantic#11132
graphite-app[bot] merged 1 commit intomainfrom
05-18-perf_mangler_mangler_build_with_semantic_take_mut_ref_to_semantic_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 18, 2025

Semantic is a very large type (600 bytes). The mangler only uses a part of it (Scoping and AstNodes), so it's a waste to copy the whole type onto the stack and then return it again.

Change Mangler::build_with_semantic to take &mut Semantic instead.

I hope this may also help a bit with wild variance in mangler benchmarks, as Semantic will no longer get dropped in the measured section (I don't think should be part of the measurement anyway, as the drop time of Semantic is not relevant in this benchmark).

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.

@github-actions github-actions bot added A-semantic Area - Semantic A-minifier Area - Minifier C-performance Category - Solution not expected to change functional behavior, only performance labels May 18, 2025
@overlookmotel overlookmotel marked this pull request as ready for review May 18, 2025 19:51
@overlookmotel overlookmotel requested a review from Dunqing as a code owner May 18, 2025 19:51
@codspeed-hq
Copy link

codspeed-hq bot commented May 18, 2025

CodSpeed Instrumentation Performance Report

Merging #11132 will not alter performance

Comparing 05-18-perf_mangler_mangler_build_with_semantic_take_mut_ref_to_semantic_ (65a6419) with main (2be4ce8)

Summary

✅ 9 untouched benchmarks
🆕 29 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 codegen[RadixUIAdoptionSection.jsx] N/A 132.2 µs N/A
🆕 codegen[binder.ts] N/A 4.8 ms N/A
🆕 codegen[cal.com.tsx] N/A 38.9 ms N/A
🆕 codegen[react.development.js] N/A 2.2 ms N/A
🆕 formatter[RadixUIAdoptionSection.jsx] N/A 299.1 µs N/A
🆕 formatter[binder.ts] N/A 15.8 ms N/A
🆕 formatter[cal.com.tsx] N/A 128.4 ms N/A
🆕 formatter[react.development.js] N/A 8.1 ms N/A
🆕 lexer[RadixUIAdoptionSection.jsx] N/A 21.8 µs N/A
🆕 lexer[binder.ts] N/A 960.5 µs N/A
🆕 lexer[cal.com.tsx] N/A 6 ms N/A
🆕 lexer[react.development.js] N/A 394.3 µs N/A
🆕 linter[RadixUIAdoptionSection.jsx] N/A 2.8 ms N/A
🆕 linter[binder.ts] N/A 146.2 ms N/A
🆕 linter[cal.com.tsx] N/A 1.3 s N/A
🆕 linter[react.development.js] N/A 53.6 ms N/A
🆕 mangler[RadixUIAdoptionSection.jsx] N/A 14.4 µs N/A
🆕 mangler[binder.ts] N/A 798 µs N/A
🆕 mangler[cal.com.tsx] N/A 3 ms N/A
🆕 mangler[react.development.js] N/A 282.6 µs N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

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

Boshen commented May 19, 2025

Merge activity

graphite-app bot pushed a commit that referenced this pull request May 19, 2025
…tic` (#11132)

`Semantic` is a very large type (600 bytes). The mangler only uses a part of it (`Scoping` and `AstNodes`), so it's a waste to copy the whole type onto the stack and then return it again.

Change `Mangler::build_with_semantic` to take `&mut Semantic` instead.

I hope this may also help a bit with wild variance in mangler benchmarks, as `Semantic` will no longer get dropped in the measured section (I don't think should be part of the measurement anyway, as the drop time of `Semantic` is not relevant in this benchmark).
@graphite-app graphite-app bot force-pushed the 05-18-perf_mangler_mangler_build_with_semantic_take_mut_ref_to_semantic_ branch from 2469dd0 to e36b39c Compare May 19, 2025 01:26
…tic` (#11132)

`Semantic` is a very large type (600 bytes). The mangler only uses a part of it (`Scoping` and `AstNodes`), so it's a waste to copy the whole type onto the stack and then return it again.

Change `Mangler::build_with_semantic` to take `&mut Semantic` instead.

I hope this may also help a bit with wild variance in mangler benchmarks, as `Semantic` will no longer get dropped in the measured section (I don't think should be part of the measurement anyway, as the drop time of `Semantic` is not relevant in this benchmark).
@graphite-app graphite-app bot force-pushed the 05-18-perf_mangler_mangler_build_with_semantic_take_mut_ref_to_semantic_ branch from e36b39c to 65a6419 Compare May 19, 2025 01:28
@graphite-app graphite-app bot merged commit 65a6419 into main May 19, 2025
23 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 19, 2025
@graphite-app graphite-app bot deleted the 05-18-perf_mangler_mangler_build_with_semantic_take_mut_ref_to_semantic_ branch May 19, 2025 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier A-semantic Area - Semantic 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