perf(semantic): remove match from enter/leave kind#12524
perf(semantic): remove match from enter/leave kind#12524
Conversation
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 Instrumentation Performance ReportMerging #12524 will not alter performanceComparing Summary
|
6631922 to
f4aa56e
Compare
| /* cfg */ | ||
|
|
||
| if let Some(continue_target) = &stmt.label { | ||
| // SAFETY: references to arena-allocated objects are valid for the lifetime of the arena |
There was a problem hiding this comment.
please keep me honest here. i think this is right. but definitely needs another set of eyes
There was a problem hiding this comment.
No unsafe needed! This does the trick:
self.unused_labels.reference(continue_target.name.as_str());.as_str() keeps the 'a lifetime.
(ditto for the other unsafe above)
f4aa56e to
0016778
Compare
0016778 to
073b23b
Compare
|
This PR is quite hard to review due to its size. If it was mostly the work of AI, and didn't require much work on top, I'd suggest scrapping it, and asking Mr Robot to do it step-by-step in multiple PRs. e.g. 1st PR just get rid of Personally I don't trust the robots quite yet, so would like to be able to check their work! It's unfortunate that all the new Is there any way we can avoid that? Currently: fn visit_import_specifier(&mut self, it: &ImportSpecifier<'a>) {
let kind = AstKind::ImportSpecifier(self.alloc(it));
self.enter_node(kind);
it.bind(self);
self.visit_span(&it.span);
self.visit_module_export_name(&it.imported);
self.visit_binding_identifier(&it.local);
self.leave_node(kind);
}This would be better: fn visit_import_specifier(&mut self, it: &ImportSpecifier<'a>) {
it.bind(self);
walk::walk_import_specifier(self, it);
}There is a difference between the two. Currently the In the case of That's just an example - I don't know how much churn it'd require to switch the order like this. But maybe worth considering? If it's too much work, another alternative would be to alter codegen for // Before
pub fn walk_import_specifier<'a, V: Visit<'a>>(visitor: &mut V, it: &ImportSpecifier<'a>) {
let kind = AstKind::ImportSpecifier(visitor.alloc(it));
visitor.enter_node(kind);
visitor.visit_span(&it.span);
visitor.visit_module_export_name(&it.imported);
visitor.visit_binding_identifier(&it.local);
visitor.leave_node(kind);
}// After
pub fn walk_import_specifier<'a, V: Visit<'a>>(visitor: &mut V, it: &ImportSpecifier<'a>) {
let kind = AstKind::ImportSpecifier(visitor.alloc(it));
visitor.enter_node(kind);
walk_children_import_specifier(visitor, it);
visitor.leave_node(kind);
}
pub fn walk_children_import_specifier<'a, V: Visit<'a>>(visitor: &mut V, it: &ImportSpecifier<'a>) {
visitor.visit_span(&it.span);
visitor.visit_module_export_name(&it.imported);
visitor.visit_binding_identifier(&it.local);
} |
|
Outcome is that we are going to:
|


all credit to @overlookmotel for the idea
most of this was by ai