Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(transformer/arrow-functions): do not inline non-trivial visitor method #8321

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jan 7, 2025

Follow-on after #8024. Don't inline visit_statements visitor method. This visitor is not so small, and always executes unconditionally. The compiler can decide whether to inline it or not. Where #[inline] is really valuable is:

  1. Where the function is tiny so the cost of moving it into the caller is small. and
  2. The function gets called a lot e.g. visit_expression, visit_statement, visit_identifier_reference.
  3. Most commonly the function checks something and exits "nothing to do here". e.g. visit_expression where you only need to transform a particular type of Expression.

Copy link
Contributor Author

overlookmotel commented Jan 7, 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.

Copy link

codspeed-hq bot commented Jan 7, 2025

CodSpeed Performance Report

Merging #8321 will not alter performance

Comparing 01-07-refactor_transformer_arrow-functions_do_not_inline_non-trivial_visitor_method (3dd08e9) with main (aebe0ea)

Summary

✅ 29 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as ready for review January 7, 2025 14:26
@overlookmotel overlookmotel requested a review from Dunqing as a code owner January 7, 2025 14:26
@overlookmotel overlookmotel force-pushed the 01-07-refactor_transformer_arrow-functions_reorder_visitor_methods branch from b3566eb to 6e071ec Compare January 7, 2025 14:46
@overlookmotel overlookmotel force-pushed the 01-07-refactor_transformer_arrow-functions_do_not_inline_non-trivial_visitor_method branch from 3357ac6 to cb02fe8 Compare January 7, 2025 14:46
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 8, 2025
Copy link

graphite-app bot commented Jan 8, 2025

Merge activity

@Dunqing Dunqing force-pushed the 01-07-refactor_transformer_arrow-functions_reorder_visitor_methods branch from 6e071ec to 32a0ee9 Compare January 8, 2025 01:34
Dunqing pushed a commit that referenced this pull request Jan 8, 2025
…tor method (#8321)

Follow-on after #8024. Don't inline `visit_statements` visitor method. This visitor is not so small, and always executes unconditionally. The compiler can decide whether to inline it or not. Where `#[inline]` is really valuable is:

1. Where the function is tiny so the cost of moving it into the caller is small. and
2. The function gets called a lot e.g. `visit_expression`, `visit_statement`, `visit_identifier_reference`.
3. Most commonly the function checks something and exits "nothing to do here". e.g. `visit_expression` where you only need to transform a particular type of `Expression`.
@Dunqing Dunqing force-pushed the 01-07-refactor_transformer_arrow-functions_do_not_inline_non-trivial_visitor_method branch from cb02fe8 to a615e76 Compare January 8, 2025 01:35
…tor method (#8321)

Follow-on after #8024. Don't inline `visit_statements` visitor method. This visitor is not so small, and always executes unconditionally. The compiler can decide whether to inline it or not. Where `#[inline]` is really valuable is:

1. Where the function is tiny so the cost of moving it into the caller is small. and
2. The function gets called a lot e.g. `visit_expression`, `visit_statement`, `visit_identifier_reference`.
3. Most commonly the function checks something and exits "nothing to do here". e.g. `visit_expression` where you only need to transform a particular type of `Expression`.
@Dunqing Dunqing force-pushed the 01-07-refactor_transformer_arrow-functions_reorder_visitor_methods branch from 32a0ee9 to ea9cefb Compare January 8, 2025 01:53
@Dunqing Dunqing force-pushed the 01-07-refactor_transformer_arrow-functions_do_not_inline_non-trivial_visitor_method branch from a615e76 to 3dd08e9 Compare January 8, 2025 01:54
Base automatically changed from 01-07-refactor_transformer_arrow-functions_reorder_visitor_methods to main January 8, 2025 02:07
@graphite-app graphite-app bot merged commit 3dd08e9 into main Jan 8, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 01-07-refactor_transformer_arrow-functions_do_not_inline_non-trivial_visitor_method branch January 8, 2025 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue 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.

1 participant