Skip to content

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Apr 2, 2025

Pure refactor, TakeIn trait is exactly used for these cases, we don't need an indirect call for move_xxx.

Copy link
Member Author

Dunqing commented Apr 2, 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.

@github-actions github-actions bot added A-parser Area - Parser A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler A-isolated-declarations Isolated Declarations labels Apr 2, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Apr 2, 2025

CodSpeed Instrumentation Performance Report

Merging #10170 will create unknown performance changes

Comparing 04-02-refactor_transformer_minifier_replace_astbuilder_move_xxxx_methods_with_takein_trait (bcdbd38) with main (c198578)

Summary

🆕 36 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 codegen[checker.ts] N/A 22.1 ms N/A
🆕 codegen_sourcemap[checker.ts] N/A 65.1 ms N/A
🆕 formatter[antd.js] N/A 7.9 ms N/A
🆕 formatter[react.development.js] N/A 43.5 µs N/A
🆕 formatter[typescript.js] N/A 7.2 ms N/A
🆕 isolated-declarations[vue-id.ts] N/A 58.2 ms N/A
🆕 lexer[RadixUIAdoptionSection.jsx] N/A 21.4 µ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 15.9 ms N/A
🆕 mangler[react.development.js] N/A 293.1 µs N/A
🆕 mangler[typescript.js] N/A 39.4 ms N/A
🆕 minifier[antd.js] N/A 166.3 ms N/A
🆕 minifier[react.development.js] N/A 1.9 ms N/A
🆕 minifier[typescript.js] N/A 293.3 ms N/A
... ... ... ... ...

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

@Dunqing Dunqing changed the title refactor(transformer, minifier) replace AstBuilder::move_xxxx methods with TakeIn trait refactor(transformer, minifier): replace AstBuilder::move_xxxx methods with TakeIn trait Apr 2, 2025
@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Apr 2, 2025
@Dunqing Dunqing marked this pull request as ready for review April 2, 2025 06:31
@Dunqing Dunqing requested a review from overlookmotel as a code owner April 2, 2025 06:31
@overlookmotel
Copy link
Member

I did this in #9970 but then decided against it, for the reasons given in #10001. I think take_in makes it too easy to pull large types onto the stack, when you could likely find a way to use move_expression or move_statement instead (which are much cheaper).

I'm not dead set on that position if you strongly disagree, but that's my overall feeling.

@Boshen
Copy link
Member

Boshen commented Apr 2, 2025

I did this in #9970 but then decided against it, for the reasons given in #10001. I think take_in makes it too easy to pull large types onto the stack, when you could likely find a way to use move_expression or move_statement instead (which are much cheaper).

I'm not dead set on that position if you strongly disagree, but that's my overall feeling.

I think we should have one way of doing things. Making decisions on TakeIn or move_xxx is really confusing ...

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Apr 4, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Apr 4, 2025

Merge activity

…ods with `TakeIn` trait (#10170)

Pure refactor, `TakeIn` trait is exactly used for these cases, we don't need an indirect call for `move_xxx`.
@graphite-app graphite-app bot force-pushed the 04-02-feat_allocator_add_takein_take_in_box_method branch from 9d82508 to c198578 Compare April 4, 2025 07:55
@graphite-app graphite-app bot force-pushed the 04-02-refactor_transformer_minifier_replace_astbuilder_move_xxxx_methods_with_takein_trait branch from 120b494 to bcdbd38 Compare April 4, 2025 07:55
Base automatically changed from 04-02-feat_allocator_add_takein_take_in_box_method to main April 4, 2025 08:10
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 4, 2025
@graphite-app graphite-app bot merged commit bcdbd38 into main Apr 4, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 04-02-refactor_transformer_minifier_replace_astbuilder_move_xxxx_methods_with_takein_trait branch April 4, 2025 08:12
@overlookmotel
Copy link
Member

@Dunqing Should we add an AstBuilder::take method, so you don't have to use TakeIn explicitly?

- declaration.take_in(self.ast.allocator)
+ self.ast.take(declaration)

I don't mind either way, just asking what you think.

@Dunqing
Copy link
Member Author

Dunqing commented Apr 8, 2025

@Dunqing Should we add an AstBuilder::take method, so you don't have to use TakeIn explicitly?

- declaration.take_in(self.ast.allocator)
+ self.ast.take(declaration)

I don't mind either way, just asking what you think.

Yes, this would be easier to use, I don't have opinion on this.

@overlookmotel
Copy link
Member

OK, I opened an issue: #10314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants