Skip to content

Commit

Permalink
perf(es): Avoid needless string comparisons (#9613)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Oct 4, 2024
1 parent e2e9a9c commit ec0a62c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changeset/dull-carrots-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
swc: patch
swc_core: patch
swc_ecma_transforms_base: patch
---

perf(es): Avoid needless string comparisons
1 change: 0 additions & 1 deletion crates/swc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
modules::import_analysis::import_analyzer(import_interop, ignore_dynamic),
need_analyzer
),
compat::reserved_words::reserved_words(),
Optional::new(
helpers::inject_helpers(self.unresolved_mark),
self.inject_helpers
Expand Down
6 changes: 3 additions & 3 deletions crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
#[cfg(feature = "concurrent-renamer")]
use rayon::prelude::*;
use rustc_hash::FxHashSet;
use swc_atoms::Atom;
use swc_atoms::{atom, Atom};
use swc_common::{collections::AHashMap, util::take::Take, Mark, SyntaxContext};
use swc_ecma_ast::*;
use tracing::debug;
Expand Down Expand Up @@ -51,7 +51,7 @@ pub(super) struct ScopeData {

impl Scope {
pub(super) fn add_decl(&mut self, id: &Id, has_eval: bool, top_level_mark: Mark) {
if id.0 == "arguments" {
if id.0 == atom!("arguments") {
return;
}

Expand All @@ -73,7 +73,7 @@ impl Scope {
}

pub(super) fn add_usage(&mut self, id: Id) {
if id.0 == "arguments" {
if id.0 == atom!("arguments") {
return;
}

Expand Down

0 comments on commit ec0a62c

Please sign in to comment.