Skip to content

chore(pack): sync turbopack canary - #3321

Merged
fireairforce merged 3 commits into
nextfrom
zoomdong/sync-turbopack-canary-20260825
Aug 25, 2026
Merged

chore(pack): sync turbopack canary#3321
fireairforce merged 3 commits into
nextfrom
zoomdong/sync-turbopack-canary-20260825

Conversation

@fireairforce

@fireairforce fireairforce commented Aug 25, 2026

Copy link
Copy Markdown
Member

Summary

The bundled Turbopack fork was behind the current vercel/next.js canary and was missing upstream runtime, filesystem, HMR, task scheduling, and build-performance improvements.

  • sync the next.js submodule to upstream canary 76e24273c77
  • preserve Utoo-specific watcher, runtime, HMR, wasm, and lightningcss behavior in submodule commit 8abf2310ba6
  • adapt pack-napi to the new backing-storage options API without changing existing behavior
  • update 8 runtime source map snapshots affected by the upstream runtime changes

Test Plan

  • cargo check
  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings --no-deps
  • cargo clippy -p pack-api -- -D warnings
  • cargo nextest r -p pack-tests — 133 passed, 41 skipped
  • cargo build --features plugin -p pack-napi --profile release-local
  • run ut build:local from packages/utoo-web
  • npm test --workspace shared-runtime-async-module

@fireairforce
fireairforce enabled auto-merge (squash) August 25, 2026 09:40
@fireairforce
fireairforce disabled auto-merge August 25, 2026 09:43
@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20260825_095455
Generated: 2026-08-25 09:54:55
Trace File: trace_antd.json (0.3GB, 0.80M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 5,831.6 ms Baseline
Total Thread Work (de-duped) 17,401.4 ms Non-overlapping busy time
Effective Parallelism 3.0x thread_work / wall_time
Working Threads 10 Threads with actual spans
Thread Utilization 29.8% ⚠️ Suboptimal
Total Spans 800,874 All B/E + X events
Meaningful Spans (>= 10us) 187,065 (23.4% of total)
Tracing Noise (< 10us) 613,809 (76.6% 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 41,918 5,501.8 1,480.8 2,578.2
Parse 8,130 1,220.0 912.1 5,114.8
Analyze 120,311 33,923.5 7,154.5 5,036.9
Chunk 5,334 5,278.9 1,024.1 2,198.8
Codegen 9,086 1,841.5 1,214.1 1,914.5
Emit 33 36.1 18.1 7.5
Other 2,253 6,833.4 4,092.1 5,831.6

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 162,523 39,889.2 229.2% 8,852.8 50.9%
P1: I/O & Heavy Tasks 2,834 102.1 0.6% 84.0 0.5%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 20,851 8,358.2 48.0% 3,162.3 18.2%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 857 6,285.7 36.1% 3,796.6 21.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
3,651.3 20,433.0 82,740 44.1 0.1 12.8 21.0% module module (60%)
2,652.7 2,790.7 18 147371.7 323.1 580.7 15.2% save snapshot persist (6%)
1,626.3 2,444.1 3,835 424.1 1.5 176.7 9.3% analyze ecmascript module analyze ecmascript module (44%)
1,132.9 10,119.4 25,977 43.6 0.1 38.1 6.5% process module process module (78%)
984.0 2,651.0 22,685 43.4 0.1 6.1 5.7% internal resolving internal resolving (73%)
879.6 4,992.5 3,930 223.8 0.2 106.7 5.1% chunking chunking (49%)
855.3 1,163.3 5,964 143.4 0.5 66.9 4.9% parse ecmascript parse ecmascript (66%)
670.9 724.7 6,904 97.2 0.4 5.5 3.9% precompute code generation generate merged code (49%)
629.7 1,928.7 603 1044.3 2.4 265.0 3.6% generate merged code chunking (69%)
628.9 726.0 5,511 114.1 0.3 112.5 3.6% compute async module info compute async module info (49%)
487.6 2,841.5 18,598 26.2 0.0 3.5 2.8% resolving module (61%)
381.0 381.0 329 1158.0 0.9 229.9 2.2% generate source map code generation (83%)
353.4 712.2 130 2718.1 4.8 207.5 2.0% emit code generate merged code (42%)
282.2 455.5 1,074 262.7 0.1 167.7 1.6% write all entrypoints to disk write all entrypoints to disk (12%)
162.3 735.9 1,853 87.6 0.2 35.1 0.9% code generation code generation (84%)
140.1 281.6 1,335 105.0 0.1 26.0 0.8% compute async chunks compute async chunks (47%)
139.1 139.1 9 15460.3 53.1 54.6 0.8% blocking save snapshot (67%)
68.7 74.5 467 147.1 0.0 25.4 0.4% compute binding usage info compute binding usage info (45%)
56.7 56.7 2,163 26.2 0.0 3.1 0.3% read file parse ecmascript (91%)
32.6 59.4 1,765 18.5 0.0 11.7 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 635.3 3 persist → save snapshot → blocking
2 475.8 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 271.5 4 chunking → generate merged code → emit code → generate source map
4 176.8 2 process module → analyze ecmascript module
5 150.6 2 save snapshot → blocking

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 25,977 process module (78%) 43.6 us 0.06 ms 1,132.9 ms
internal resolving 22,685 internal resolving (73%) 43.4 us 0.07 ms 984.0 ms

Duration Distribution

Range Count Percentage
<10us 613,809 76.6%
10us-100us 120,595 15.1%
100us-1ms 57,346 7.2%
1ms-10ms 8,917 1.1%
10ms-100ms 177 0.0%
>100ms 30 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 enabled auto-merge (squash) August 25, 2026 10:32
@fireairforce
fireairforce merged commit ba792ab into next Aug 25, 2026
69 of 83 checks passed
@fireairforce
fireairforce deleted the zoomdong/sync-turbopack-canary-20260825 branch August 25, 2026 10:33
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