Skip to content

Conversation

@overlookmotel
Copy link
Member

No description provided.

Copy link
Member Author

overlookmotel commented Mar 22, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


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-parser Area - Parser A-minifier Area - Minifier A-ast Area - AST A-transformer Area - Transformer / Transpiler A-isolated-declarations Isolated Declarations C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Mar 22, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 22, 2025

CodSpeed Instrumentation Performance Report

Merging #9970 will create unknown performance changes

Comparing 03-22-refactor_ast_replace_astbuilder_move__methods_with_take_ (682d612) with 03-22-feat_allocator_takein_trait (d3ea17d)

Summary

🆕 33 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 codegen[checker.ts] N/A 22.6 ms N/A
🆕 codegen_sourcemap[checker.ts] N/A 65.6 ms N/A
🆕 isolated-declarations[vue-id.ts] N/A 58.3 ms N/A
🆕 lexer[RadixUIAdoptionSection.jsx] N/A 21.2 µs N/A
🆕 lexer[antd.js] N/A 24.8 ms N/A
🆕 lexer[cal.com.tsx] N/A 5.9 ms N/A
🆕 lexer[checker.ts] N/A 14.8 ms N/A
🆕 lexer[pdf.mjs] N/A 3.9 ms N/A
🆕 linter[RadixUIAdoptionSection.jsx] N/A 2.7 ms N/A
🆕 linter[cal.com.tsx] N/A 1.2 s N/A
🆕 linter[checker.ts] N/A 3 s N/A
🆕 mangler[antd.js] N/A 16 ms N/A
🆕 mangler[react.development.js] N/A 294.7 µs N/A
🆕 mangler[typescript.js] N/A 39.6 ms N/A
🆕 minifier[antd.js] N/A 165.7 ms N/A
🆕 minifier[react.development.js] N/A 1.8 ms N/A
🆕 minifier[typescript.js] N/A 291.9 ms N/A
🆕 estree[checker.ts] N/A 96.1 ms N/A
🆕 parser[RadixUIAdoptionSection.jsx] N/A 92.8 µs N/A
🆕 parser[antd.js] N/A 113.6 ms N/A
... ... ... ... ...

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

@overlookmotel overlookmotel force-pushed the 03-22-feat_allocator_takein_trait branch from 6711ae3 to cd29674 Compare March 23, 2025 05:18
@overlookmotel overlookmotel force-pushed the 03-22-refactor_ast_replace_astbuilder_move__methods_with_take_ branch from 1b55db0 to 0b7666d Compare March 23, 2025 05:18
@overlookmotel overlookmotel force-pushed the 03-22-feat_allocator_takein_trait branch from cd29674 to d9b1775 Compare March 23, 2025 07:41
@overlookmotel overlookmotel force-pushed the 03-22-refactor_ast_replace_astbuilder_move__methods_with_take_ branch 2 times, most recently from db93324 to bf9c9fb Compare March 23, 2025 07:45
@overlookmotel overlookmotel force-pushed the 03-22-feat_allocator_takein_trait branch from d9b1775 to 46d3858 Compare March 23, 2025 07:45
@overlookmotel overlookmotel force-pushed the 03-22-refactor_ast_replace_astbuilder_move__methods_with_take_ branch from bf9c9fb to 682d612 Compare March 24, 2025 03:23
@overlookmotel overlookmotel deleted the 03-22-refactor_ast_replace_astbuilder_move__methods_with_take_ branch March 24, 2025 06:46
graphite-app bot pushed a commit that referenced this pull request Mar 24, 2025
`AstBuilder::move_*` methods use `TakeIn::take_in` (added in #9969) to replace nodes with dummy nodes.

`take_in` will always generate a dummy in whatever way minimizes the size and number of allocations required.

It would be possible to replace all the `move_*` methods with a single `AstBuilder::take` method which is generic over `T: TakeIn` (#9970). But have opted not to do that, because it's useful to be able to see in calling code what type of node is being replaced.

Some nodes are quite expensive to create a dummy for (e.g. `Declaration` and `Function` require allocating 56 bytes into arena, `ArrowFunctionExpression` allocates 128 bytes in 2 separate allocations), so it's useful to see where we're doing that, so we can try to replace them with cheaper operations e.g. replacing an `Expression` or `Statement` instead (only 8 bytes). We also want to avoid inadvertently adding further expensive `take_in` calls, which a blanket `AstBuilder::take` method would make it easy to do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-isolated-declarations Isolated Declarations A-minifier Area - Minifier A-parser Area - Parser A-transformer Area - Transformer / Transpiler C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants