perf(transformer/using): inline enter_statement#9680
Merged
graphite-app[bot] merged 1 commit intoMar 11, 2025
Conversation
This was referenced Mar 11, 2025
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
CodSpeed Performance ReportMerging #9680 will create unknown performance changesComparing Summary
Benchmarks breakdown
|
Member
Author
A small gain. I guess most of the cost of #9310 is iterating over statements, as we suspected. |
camc314
approved these changes
Mar 11, 2025
24ebeb0 to
e136646
Compare
6a7dcbd to
f46312c
Compare
Member
Merge activity
|
e136646 to
4cee555
Compare
f46312c to
8b7d2ef
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Mar 11, 2025
`enter_statement` is a hot path, and most `Statement`s are not `BlockStatement`s or `SwitchStatement`s, so in most cases this method does nothing. Optimize for the common "nothing to do here" case by moving as much logic as possible out of `enter_statement`, to make that function as small as possible, so it can be inlined. Mark it `#[inline]`. Hopefully now when a `Statement` is neither of the types this visitor is interested in, finding that out and exiting will just be a couple of quick checks, and won't incur the cost of a function call.
graphite-app Bot
pushed a commit
that referenced
this pull request
Mar 11, 2025
`enter_statement` is a hot path, and most `Statement`s are not `BlockStatement`s or `SwitchStatement`s, so in most cases this method does nothing. Optimize for the common "nothing to do here" case by moving as much logic as possible out of `enter_statement`, to make that function as small as possible, so it can be inlined. Mark it `#[inline]`. Hopefully now when a `Statement` is neither of the types this visitor is interested in, finding that out and exiting will just be a couple of quick checks, and won't incur the cost of a function call.
8b7d2ef to
1b8c6b0
Compare
`enter_statement` is a hot path, and most `Statement`s are not `BlockStatement`s or `SwitchStatement`s, so in most cases this method does nothing. Optimize for the common "nothing to do here" case by moving as much logic as possible out of `enter_statement`, to make that function as small as possible, so it can be inlined. Mark it `#[inline]`. Hopefully now when a `Statement` is neither of the types this visitor is interested in, finding that out and exiting will just be a couple of quick checks, and won't incur the cost of a function call.
76df73e to
4dc32db
Compare
1b8c6b0 to
d303ba9
Compare
Base automatically changed from
03-11-test_transformer_using_failing_test_for_class_name
to
main
March 11, 2025 12:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


enter_statementis a hot path, and mostStatements are notBlockStatements orSwitchStatements, so in most cases this method does nothing.Optimize for the common "nothing to do here" case by moving as much logic as possible out of
enter_statement, to make that function as small as possible, so it can be inlined. Mark it#[inline].Hopefully now when a
Statementis neither of the types this visitor is interested in, finding that out and exiting will just be a couple of quick checks, and won't incur the cost of a function call.