From 3dd08e978605629dc3bc3b362bb8edfd2ba31219 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed, 8 Jan 2025 01:52:44 +0000 Subject: [PATCH] refactor(transformer/arrow-functions): do not inline non-trivial visitor 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`. --- crates/oxc_transformer/src/common/arrow_function_converter.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/oxc_transformer/src/common/arrow_function_converter.rs b/crates/oxc_transformer/src/common/arrow_function_converter.rs index dbb57506c6027..fd549a6063352 100644 --- a/crates/oxc_transformer/src/common/arrow_function_converter.rs +++ b/crates/oxc_transformer/src/common/arrow_function_converter.rs @@ -1137,7 +1137,6 @@ impl<'a> VisitMut<'a> for ConstructorBodyThisAfterSuperInserter<'a, '_> { } /// `super()` -> `super(); _this = this;` - #[inline] fn visit_statements(&mut self, statements: &mut ArenaVec<'a, Statement<'a>>) { let mut new_stmts = vec![];