swc-project
swc
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
perf: Optimize Atom equality (#11902) <!-- Note: CI script will automatically rebase your PR so please do not rebase unless required --> <!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> **Description:** This PR optimizes `Atom` equality checks in `hstr` and `swc_atoms` without adding benchmark files. Changes: - Inline the `PartialEq` fast path for `hstr::Atom` and `Wtf8Atom` instead of forcing `#[inline(never)]`. - Return `false` immediately for non-identical inline atoms, because inline atoms encode both length and bytes in the tagged value. - Keep dynamic atom equality correct across different `AtomStore`s by preserving the hash + slice fallback. - Hand-write `swc_atoms::Atom` `PartialEq` / `Hash` wrapper impls and inline wrapper equality helpers. - Add equality coverage to existing unit tests. Local CodSpeed simulation was used with a temporary equality benchmark before removing the benchmark from this PR. Representative results: | Benchmark | Accesses | Δ | Estimated cycles | Δ | |---|---:|---:|---:|---:| | `hstr::Atom inline/equal` | 24 → 14 | -41.7% | 549 → 434 | -20.9% | | `hstr::Atom inline/different` | 40 → 24 | -40.0% | 670 → 549 | -18.1% | | `hstr::Atom dynamic/same-store/equal` | 24 → 14 | -41.7% | 549 → 434 | -20.9% | | `hstr::Atom dynamic/other-store/equal` | 73 → 62 | -15.1% | 1438 → 1217 | -15.4% | | `hstr::Atom dynamic/different` | 37 → 29 | -21.6% | 877 → 764 | -12.9% | | `swc_atoms::Atom inline/equal` | 24 → 14 | -41.7% | 549 → 434 | -20.9% | | `swc_atoms::Atom dynamic/other-store/equal` | 73 → 62 | -15.1% | 1753 → 1322 | -24.6% | | `swc_atoms::Atom dynamic/equal-atom-macro` | 107 → 96 | -10.3% | 2102 → 1566 | -25.5% | Validation: - `git submodule update --init --recursive` - `cargo fmt --all --check` - `cargo test -p hstr` - `cargo test -p hstr --features serde` - `cargo test -p swc_atoms` - `cargo clippy --all --all-targets -- -D warnings` **BREAKING CHANGE:** No breaking change. **Related issue (if exists):** N/A --------- Co-authored-by: DongYun Kang <kdy.1997.dev@gmail.com>
main
10 hours ago
chore: Add changeset for atom equality optimization
hardfist:perf/optimize-atom-eq
11 hours ago
perf: optimize atom equality
hardfist:perf/optimize-atom-eq
11 hours ago
perf: optimize atom equality
hardfist:perf/optimize-atom-eq
12 hours ago
revert(es/decorators): revert decorator initializer ordering (#11901) **Description:** Reverts swc-project/swc#11847 because the helper changes shipped in `@swc/helpers@0.5.22` caused a decorator helper regression. This restores the previous 2022-03 decorator initializer behavior, removes the regression fixtures added by #11847, reverts the matching external helper source, and adds a patch changeset for the touched Rust crates. `@swc/helpers@0.5.22` has been deprecated on npm with an upgrade note for `0.5.23`. Validation: - `git submodule update --init --recursive` - `cargo fmt --all` - `cargo test -p swc_ecma_transforms_base` - `cargo test -p swc_ecma_transforms_proposal` - `cargo clippy --all --all-targets -- -D warnings` `pnpm --filter @swc/helpers build` was also attempted, but local `node_modules` is not installed in this checkout, so `zx` was unavailable. **BREAKING CHANGE:** None. **Related issue (if exists):** Reverts #11847
main
13 hours ago
revert(es/decorators): revert decorator initializer ordering
kdy1/revert-11847-helper-regression
13 hours ago
fix(es/resolver): Include export import aliases in namespace pre-scan `pre_scan_namespace_exports` only inspected `ModuleDecl::ExportDecl`, so `export import A = ...` (a `TsImportEqualsDecl { is_export: true, .. }`) was never added to `namespace_export_names`. The alias binding was then routed to the body-local scope instead of the namespace's merged export scope, and references from sibling re-opens of the same namespace fell through to outer/unresolved bindings, violating TypeScript's namespace-merge semantics. Recognise the exported import-equals form in the pre-scan, adding the alias to `values` (and to `types` when not `is_type_only`), mirroring how `export namespace`/`export class`/`export enum` are tracked. The existing `visit_mut_ts_import_equals_decl` `modify` call now routes the binding to the shared export scope, and type-position lookups in sibling bodies resolve through `mark_for_ref_inner`'s `declared_types -> declared_symbols` fall-through. Signed-off-by: Onyeka Obi <softwareengineerasaservant@isurvivable.cv>
MavenRain:fix/resolver-namespace-merge
1 day ago
chore: start keyword hashing optimization
hardfist:perf/perfect-keyword-hashing
1 day ago
Latest Branches
CodSpeed Performance Gauge
+2%
perf: Optimize Atom equality
#11902
11 hours ago
d790b90
hardfist:perf/optimize-atom-eq
CodSpeed Performance Gauge
0%
revert(es/decorators): revert decorator initializer ordering
#11901
14 hours ago
3273a08
kdy1/revert-11847-helper-regression
CodSpeed Performance Gauge
0%
fix(es/resolver): Merge re-opened TypeScript namespace scopes
#11872
5 days ago
7aa055b
MavenRain:fix/resolver-namespace-merge
© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs