From 1e0156e858bdd0e71501eca779e7e3e9afce4ba0 Mon Sep 17 00:00:00 2001 From: YunfeiHe Date: Thu, 24 Nov 2022 10:44:03 +0800 Subject: [PATCH] perf(es/transform_base): return early if any helper is used --- crates/swc_ecma_transforms_base/src/helpers/mod.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/swc_ecma_transforms_base/src/helpers/mod.rs b/crates/swc_ecma_transforms_base/src/helpers/mod.rs index 2ef7ff3e0bcd..a96449f68f17 100644 --- a/crates/swc_ecma_transforms_base/src/helpers/mod.rs +++ b/crates/swc_ecma_transforms_base/src/helpers/mod.rs @@ -170,15 +170,12 @@ macro_rules! define_helpers { impl InjectHelpers { fn is_helper_used(&self) -> bool{ - let mut value = false; HELPERS.with(|helpers|{ - $( - value |= helpers.inner.$name.load(Ordering::Relaxed); + false $( + || helpers.inner.$name.load(Ordering::Relaxed) )* - }); - - value + }) } fn build_helpers(&self) -> Vec {