Skip to content

Commit ec0a62c

Browse files
authored
perf(es): Avoid needless string comparisons (#9613)
1 parent e2e9a9c commit ec0a62c

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Diff for: .changeset/dull-carrots-smell.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
swc: patch
3+
swc_core: patch
4+
swc_ecma_transforms_base: patch
5+
---
6+
7+
perf(es): Avoid needless string comparisons

Diff for: crates/swc/src/builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
337337
modules::import_analysis::import_analyzer(import_interop, ignore_dynamic),
338338
need_analyzer
339339
),
340-
compat::reserved_words::reserved_words(),
341340
Optional::new(
342341
helpers::inject_helpers(self.unresolved_mark),
343342
self.inject_helpers

Diff for: crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88
#[cfg(feature = "concurrent-renamer")]
99
use rayon::prelude::*;
1010
use rustc_hash::FxHashSet;
11-
use swc_atoms::Atom;
11+
use swc_atoms::{atom, Atom};
1212
use swc_common::{collections::AHashMap, util::take::Take, Mark, SyntaxContext};
1313
use swc_ecma_ast::*;
1414
use tracing::debug;
@@ -51,7 +51,7 @@ pub(super) struct ScopeData {
5151

5252
impl Scope {
5353
pub(super) fn add_decl(&mut self, id: &Id, has_eval: bool, top_level_mark: Mark) {
54-
if id.0 == "arguments" {
54+
if id.0 == atom!("arguments") {
5555
return;
5656
}
5757

@@ -73,7 +73,7 @@ impl Scope {
7373
}
7474

7575
pub(super) fn add_usage(&mut self, id: Id) {
76-
if id.0 == "arguments" {
76+
if id.0 == atom!("arguments") {
7777
return;
7878
}
7979

0 commit comments

Comments
 (0)