Repository navigation
perf(transformer_v1): merge ES2022-ES2016 and RegExp hooks into a single pass - #1823
Conversation
Deploying swc-next with
|
| Latest commit: |
5cda699
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7eea07a9.swc-next.pages.dev |
| Branch Preview URL: | https://12-04-refactor-transform-v1.swc-next.pages.dev |
Binary size diffLinux x64 GNU · release · uncompressed, stripped bindings. Merge:
|
JavaScript API Gungraun benchmark diffBase: Values are shown as Download the raw Gungraun and Valgrind data (retained for 90 days). Callgrind metric changesMedian instruction counts from three processes, shown as compare / base in K (1,000), truncated to whole thousands. Percentages are rounded to at most three decimal places. Lower is better: 🟢 improvement, 🔴 regression, ⚪ unchanged or overlapping ranges (inconclusive). JIT disabled (--jitless); predictable mode enabled (--predictable). Counts are not wall time. Exact counts, ranges and profiles are retained in artifacts. Generate
Lang
Parse
Source type
Walk
Benchmark resultsExact instruction counts: median (min–max).
|
Gungraun benchmark diffBase SHA: 36468c4 Values are shown as Download the raw Gungraun and Valgrind data (retained for 90 days). Callgrind metric changesCallgrind instruction counts (Ir) for the compare and base revisions. Values are shown as compare / base in K (1,000), truncated to whole thousands. Multi-part profiles use the part numbers from Gungraun and include an aggregated Total. New and Removed identify benchmarks that exist on only one side; the missing value is shown as a dash. Percentages are rounded to at most three decimal places. Lower is better: 🟢 improvement, 🔴 regression, ⚪ unchanged. Formatter
Generator
Minifier
Parser
Semantic
Transform
Type strip
Visit
Benchmark results |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Motivation
In
swc_next_ecma_transformer_v1, each ES2022–ES2016 and RegExp transform previously ran as its own full-AST pass (12 full traversals when all are enabled), whereas SWC'sswc_ecma_preset_envruns standalone class and optional-chaining passes followed by a single composed hook traversal (5 full traversals). Runningoptional_chaininginsidees2020also placed it afterprivate_in_objectandlogical_assignmentsinstead of before the hook pass.Changes
env::transformand a flat single-passTraverseMutdispatcher (EnvHookPass) incrates/swc_ecma_transformer_v1/src/env/pass.rsmatching SWC'spreset_envorder:VisitMutpasses first:class_fields_use_set→class_static_block→class_properties→optional_chaining.export_namespace_frompass without a recursive traversal when no other hooks are enabled.TraverseMutpass forprivate_in_object,logical_assignments,nullish_coalescing,optional_catch_binding,object_rest_spread,async_to_generator,exponentiation,regexp, and on-demandVarDeclarations.#[inline]inherent hook methods while keepingVisitMuton standalone passes andTraverseMutonEnvHookPass.private_in_object's statement-list variable store fromVarDeclarations's arrow-expression scoping so both compose cleanly when enabled together.composed_env_hooks) covering multi-hook interactions.cargo fmt --all -- --check,cargo clippy -p swc_next_ecma_transformer_v1 -p swc_next --all-targets -- -D warnings,cargo test -p swc_next_ecma_transformer_v1, and the full Rust conformance suite (tasks/testsuite/snapshotshas zero diffs).three-0.138.3.js,App.tsx,kitchen-sink.tsx) with the fulltransform_v1config, and 24%–27% lower walltime on env-focused configs.