Skip to content

fix(pack): align SWC helpers for named RegExp groups - #3433

Merged
fireairforce merged 2 commits into
nextfrom
zoomdong/fix-swc-helpers-regexp
Oct 30, 2026
Merged

fireairforce merged 2 commits into
nextfrom
zoomdong/fix-swc-helpers-regexp

Conversation

@fireairforce

@fireairforce fireairforce commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Production builds targeting older browsers can fail with Can't resolve '@swc/helpers/_/_wrap_reg_exp' when SWC lowers named RegExp capture groups. Pack still pins helpers to 0.5.15, which does not export the helper emitted by its compiler.

Pin @swc/helpers to 0.5.23 and add a real production-build regression covering named groups, backreferences, and named replacements. The test checks that the helper is emitted and executes the generated bundle.

Test Plan

  • Reproduced the missing-helper failure with 0.5.15; the new regression passes with 0.5.23, using the published Pack 1.5.35 native binding for both runs.
  • npm run build:js --workspace @utoo/pack
  • npm test --workspace @utoo/pack-shared (6 tests passed)
  • cargo fmt --check, npx tombi format --check, npx biome ci, typos, and git diff --check

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T08:54:48.055889Z e927f9c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@fireairforce
fireairforce enabled auto-merge (squash) October 30, 2026 08:57
@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20261030_091330
Generated: 2026-10-30 09:13:30
Trace File: trace_antd.json (0.3GB, 0.84M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 8,439.1 ms Baseline
Total Thread Work (de-duped) 26,999.4 ms Non-overlapping busy time
Effective Parallelism 3.2x thread_work / wall_time
Working Threads 10 Threads with actual spans
Thread Utilization 32.0% ⚠️ Suboptimal
Total Spans 843,911 All B/E + X events
Meaningful Spans (>= 10us) 239,075 (28.3% of total)
Tracing Noise (< 10us) 604,836 (71.7% of total)

Build Phase Timeline

Shows when each build phase is active and how much CPU it consumes.
Self-Time is the time spent exclusively in that phase (excluding children).

Phase Spans Inclusive (ms) Self-Time (ms) Wall Range (ms)
Resolve 51,372 9,423.8 2,776.8 4,616.5
Parse 8,184 1,721.3 1,278.4 7,724.8
Analyze 154,181 61,811.4 13,900.0 7,636.7
Chunk 5,422 7,610.3 1,219.1 2,776.5
Codegen 16,074 2,944.4 1,865.8 2,346.2
Emit 29 44.7 22.4 9.8
Other 3,813 7,756.9 4,329.5 8,439.0

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 206,401 71,860.9 266.2% 16,919.4 62.7%
P1: I/O & Heavy Tasks 2,889 132.6 0.5% 110.2 0.4%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 28,287 12,306.0 45.6% 4,369.0 16.2%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 1,498 7,013.5 26.0% 3,993.3 14.8%

Top 20 Tasks by Self-Time

Self-time is the exclusive duration: time spent in the task itself, not in sub-tasks.
This is the most accurate indicator of where CPU cycles are actually spent.

Self (ms) Inclusive (ms) Count Avg Self (us) P95 Self (ms) Max Self (ms) % Work Task Name Top Caller
7,306.3 38,320.9 104,992 69.6 0.1 16.2 27.1% module module (64%)
3,060.0 3,253.3 2,604 1175.1 4.2 336.1 11.3% analyze ecmascript module module (67%)
2,654.6 2,811.8 17 156154.0 374.2 514.9 9.8% save snapshot persist (6%)
2,264.8 18,611.2 36,504 62.0 0.1 8.8 8.4% process module process module (82%)
1,757.9 4,425.6 28,048 62.7 0.1 6.1 6.5% internal resolving internal resolving (77%)
1,207.2 1,650.1 6,014 200.7 0.8 46.2 4.5% parse ecmascript parse ecmascript (65%)
1,115.0 1,233.9 13,732 81.2 0.4 9.8 4.1% precompute code generation generate merged code (39%)
1,105.7 1,291.1 7,416 149.1 0.7 122.2 4.1% compute async module info compute async module info (57%)
1,071.3 7,339.9 4,085 262.3 0.6 109.3 4.0% chunking chunking (52%)
1,002.3 4,981.6 22,634 44.3 0.0 6.0 3.7% resolving module (56%)
771.6 2,488.0 1,237 623.7 1.4 206.1 2.9% generate merged code chunking (35%)
482.8 482.8 329 1467.5 1.5 283.1 1.8% generate source map code generation (83%)
386.0 854.9 134 2880.4 5.0 216.0 1.4% emit code emit code (43%)
313.6 670.0 1,828 171.5 0.1 160.4 1.2% write all entrypoints to disk write all entrypoints to disk (17%)
268.0 1,227.7 2,013 133.1 0.3 56.2 1.0% code generation code generation (83%)
157.3 157.3 5 31453.3 121.4 150.3 0.6% blocking save snapshot (80%)
143.3 265.3 1,278 112.1 0.1 13.5 0.5% compute async chunks compute async chunks (39%)
76.9 101.2 777 99.0 0.1 35.4 0.3% compute binding usage info compute binding usage info (51%)
72.8 124.2 1,871 38.9 0.0 26.5 0.3% collect mergeable modules collect mergeable modules (100%)
71.1 71.1 2,168 32.8 0.0 3.1 0.3% read file parse ecmascript (91%)

Critical Path Analysis

The longest sequential dependency chains that determine wall-clock time.
Focus on reducing the depth of these chains to improve parallelism.

Rank Self-Time (ms) Depth Path
1 665.3 3 persist → save snapshot → blocking
2 423.3 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 339.3 10 module → module → module → ... → process module → analyze ecmascript module → analyze ecmascript module
4 325.5 4 chunking → generate merged code → emit code → generate source map
5 241.5 4 process module → process module → analyze ecmascript module → analyze ecmascript module

Batching Candidates

High-volume tasks dominated by a single parent. If the parent can batch them,
it drastically reduces scheduler overhead.

Task Name Count Top Caller (Attribution) Avg Self P95 Self Total Self
process module 36,504 process module (82%) 62.0 us 0.08 ms 2,264.8 ms
internal resolving 28,048 internal resolving (77%) 62.7 us 0.10 ms 1,757.9 ms

Duration Distribution

Range Count Percentage
<10us 604,836 71.7%
10us-100us 155,424 18.4%
100us-1ms 66,142 7.8%
1ms-10ms 17,121 2.0%
10ms-100ms 342 0.0%
>100ms 46 0.0%

Action Items

  1. [P0] Focus on tasks with the highest Self-Time — these are where CPU cycles are actually spent.
  2. [P0] Use Batching Candidates to identify callers that should use try_join or reduce #[turbo_tasks::function] granularity.
  3. [P1] Check Build Phase Timeline for phases with disproportionate wall range vs. self-time (= serialization).
  4. [P1] Inspect P95 Self (ms) for heavy monolith tasks. Focus on long-tail outliers, not averages.
  5. [P1] Review Critical Paths — reducing the longest chain depth directly improves wall-clock time.
  6. [P2] If Thread Utilization < 60%, investigate scheduling gaps (lock contention or deep dependency chains).

Report generated by Utoopack Performance Analysis Agent

@fireairforce
fireairforce merged commit a0cd6a8 into next Oct 30, 2026
66 of 72 checks passed
@fireairforce
fireairforce deleted the zoomdong/fix-swc-helpers-regexp branch October 30, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants