perf(transformer/optional-chaining): mark enter_expression as inline#7390
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #7390 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
I suggest to move more code out of enter_expression. To make sure enter_expression gets inlined, you want the function to be as small as possible. Only include logic which is "unless [cheap check], do nothing".
The point is that in most cases expr is not a ChainExpression or a UnaryExpression with delete operator, so want to make enter_expression as optimized as possible for the common "nothing to do here" path.
In practice, this means to move these two blocks out into separate functions:
if self.is_inside_function_parameter {
// To insert the temp binding in the correct scope, we wrap the expression with
// an arrow function. During the chain expression transformation, the temp binding
// will be inserted into the arrow function's body.
Self::wrap_arrow_function(expr, ctx)
} else {
self.transform_chain_expression(false, expr, ctx)
}if self.is_inside_function_parameter {
// Same as the above explanation
Self::wrap_arrow_function(expr, ctx)
} else {
self.transform_chain_expression(true, &mut unary_expr.argument, ctx)
}enter_expression as inline
Thank you for your long explanation, I think I understand now! |
|
No change 🤔 Maybe it was already inlined. |
|
I'm going to try some stuff... marking as draft for now. |
Merge activity
|
01a2270 to
0bc763f
Compare
0bc763f to
528b2f4
Compare
528b2f4 to
679a56a
Compare
679a56a to
e26916c
Compare
|
No change in benchmarks. But I still think this change is good. The smaller we can make all |

No description provided.