Skip to content

fix(pack): upgrade SWC helpers for named capture transforms - #3434

Closed
xusd320 wants to merge 1 commit into
nextfrom
xusd320/fix-pack-swc-helpers
Closed

xusd320 wants to merge 1 commit into
nextfrom
xusd320/fix-pack-swc-helpers

Conversation

@xusd320

@xusd320 xusd320 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Summary

SWC can emit @swc/helpers/_/_wrap_reg_exp when lowering regular expressions with named capture groups. Pack pins helpers 0.5.15, which does not export this helper, so affected modules fail to bundle with Module not found.

Changes

  • Upgrade Pack's pinned @swc/helpers dependency from 0.5.15 to 0.5.23, which includes _wrap_reg_exp.

Validation

  • biome check packages/pack/package.json: passed.
  • Runtime smoke checks using helpers 0.5.23: named capture groups from exec() and named replacement groups both passed.
  • Compared package exports: all 110 exports from helpers 0.5.15 are retained in 0.5.23.
  • Production application build with published @utoo/pack@1.5.35 and the same helpers override: passed.
  • Full Rust and Pack test suites: Not run; this change only updates the helper dependency.

Risk / rollout

Generated bundles use the updated helper implementations. No configuration or data migration is required.

Reviewer notes

The helper dependency remains pinned to an exact version. The repository ignores package-lock.json, so no lockfile is added.

@xusd320 xusd320 closed this Oct 30, 2026
@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20261030_091835
Generated: 2026-10-30 09:18:35
Trace File: trace_antd.json (0.3GB, 0.85M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 7,273.4 ms Baseline
Total Thread Work (de-duped) 21,883.7 ms Non-overlapping busy time
Effective Parallelism 3.0x thread_work / wall_time
Working Threads 9 Threads with actual spans
Thread Utilization 33.4% ⚠️ Suboptimal
Total Spans 845,440 All B/E + X events
Meaningful Spans (>= 10us) 225,720 (26.7% of total)
Tracing Noise (< 10us) 619,720 (73.3% 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 49,272 7,022.0 1,951.2 3,453.5
Parse 8,196 1,559.5 1,175.6 6,532.1
Analyze 148,114 47,876.4 9,830.5 6,440.2
Chunk 5,336 6,406.5 1,073.8 2,685.2
Codegen 11,623 2,572.8 1,658.2 2,333.0
Emit 32 47.5 23.8 9.2
Other 3,147 7,987.0 4,526.6 7,273.4

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 197,816 55,590.8 254.0% 12,089.3 55.2%
P1: I/O & Heavy Tasks 2,893 138.0 0.6% 114.3 0.5%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 23,684 10,548.1 48.2% 3,902.8 17.8%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 1,327 7,194.8 32.9% 4,133.1 18.9%

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
4,823.2 27,835.9 100,675 47.9 0.1 10.6 22.0% module module (61%)
2,750.0 2,940.8 18 152777.1 359.4 537.3 12.6% save snapshot persist (6%)
2,460.7 2,616.1 2,622 938.5 3.2 253.9 11.2% analyze ecmascript module module (68%)
1,656.7 16,296.4 35,212 47.1 0.1 5.3 7.6% process module process module (83%)
1,244.4 3,409.5 26,234 47.4 0.1 4.7 5.7% internal resolving internal resolving (76%)
1,101.4 1,485.3 6,018 183.0 0.7 48.0 5.0% parse ecmascript parse ecmascript (66%)
933.5 1,016.4 9,353 99.8 0.4 11.8 4.3% precompute code generation generate merged code (48%)
895.8 6,127.7 4,014 223.2 0.2 122.5 4.1% chunking chunking (56%)
764.7 896.2 7,009 109.1 0.4 147.6 3.5% compute async module info compute async module info (57%)
734.8 2,439.7 1,053 697.8 1.7 238.8 3.4% generate merged code chunking (43%)
690.5 3,596.2 22,355 30.9 0.0 4.8 3.2% resolving module (57%)
496.6 496.6 329 1509.6 1.2 299.8 2.3% generate source map code generation (83%)
433.4 896.9 132 3283.1 4.5 265.1 2.0% emit code generate merged code (42%)
365.3 652.1 1,380 264.7 0.1 213.6 1.7% write all entrypoints to disk write all entrypoints to disk (15%)
228.0 1,059.7 1,941 117.5 0.2 63.7 1.0% code generation code generation (84%)
192.3 192.3 7 27473.4 121.2 160.2 0.9% blocking save snapshot (43%)
173.4 273.9 1,233 140.6 0.1 34.9 0.8% compute async chunks compute async chunks (39%)
74.2 74.2 2,176 34.1 0.0 2.6 0.3% read file parse ecmascript (91%)
69.5 83.5 707 98.4 0.0 41.8 0.3% compute binding usage info compute binding usage info (53%)
38.8 70.7 1,869 20.8 0.0 12.6 0.2% collect mergeable modules collect mergeable modules (100%)

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 697.5 3 persist → save snapshot → blocking
2 504.9 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 350.6 4 chunking → generate merged code → emit code → generate source map
4 332.5 2 save snapshot → blocking
5 254.3 8 module → module → process module → process module → process module → process module → process 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 35,212 process module (83%) 47.1 us 0.07 ms 1,656.7 ms
internal resolving 26,234 internal resolving (76%) 47.4 us 0.09 ms 1,244.4 ms

Duration Distribution

Range Count Percentage
<10us 619,720 73.3%
10us-100us 146,382 17.3%
100us-1ms 66,431 7.9%
1ms-10ms 12,645 1.5%
10ms-100ms 214 0.0%
>100ms 48 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

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.

1 participant