Skip to content

fix(pack): circular dependency reexport#2899

Merged
fireairforce merged 2 commits into
nextfrom
fix-re-export-circular
May 6, 2026
Merged

fix(pack): circular dependency reexport#2899
fireairforce merged 2 commits into
nextfrom
fix-re-export-circular

Conversation

@fireairforce
Copy link
Copy Markdown
Member

@fireairforce fireairforce commented May 6, 2026

Summary

fix circurlar reexport cause runtime error

ref pr: utooland/next.js#144

closes: #2582

Test Plan

add test case here

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates and introduces several test snapshots for Turbopack, focusing on circular dependencies and tree-shaking optimizations. It adds a new test case for circular dependencies involving barrel re-exports and a regression test for a bug where imports from side-effect-free barrels were incorrectly dropped during optimization. Additionally, existing snapshots are updated to reflect fixes in module concatenation and unused import removal, and the next.js subproject reference is updated. I have no feedback to provide as there are no review comments.

@fireairforce fireairforce marked this pull request as ready for review May 6, 2026 09:57
@fireairforce fireairforce force-pushed the fix-re-export-circular branch from 02ba4f6 to 03b2075 Compare May 6, 2026 10:03
@fireairforce fireairforce enabled auto-merge (squash) May 6, 2026 10:08
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20260506_102130
Generated: 2026-05-06 10:21:30
Trace File: trace_antd.json (0.5GB, 1.57M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 12,338.2 ms Baseline
Total Thread Work (de-duped) 37,861.7 ms Non-overlapping busy time
Effective Parallelism 3.1x thread_work / wall_time
Working Threads 5 Threads with actual spans
Thread Utilization 61.4% 🆗 Average
Total Spans 1,567,749 All B/E + X events
Meaningful Spans (>= 10us) 409,515 (26.1% of total)
Tracing Noise (< 10us) 1,158,234 (73.9% 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 94,702 6,310.7 5,131.8 8,523.9
Parse 11,111 2,773.9 2,448.2 12,215.6
Analyze 242,755 26,893.0 19,695.2 11,794.6
Chunk 20,513 2,200.0 2,041.3 9,588.9
Codegen 31,146 4,245.3 3,142.4 9,666.4
Emit 38 41.5 20.6 9,693.2
Other 9,250 1,700.6 1,282.2 12,233.8

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 343,995 34,351.7 90.7% 25,579.3 67.6%
P1: I/O & Heavy Tasks 3,074 180.2 0.5% 159.3 0.4%
P2: Architecture (Locks/Memory) 1 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 61,263 9,165.3 24.2% 7,577.9 20.0%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 1,182 467.8 1.2% 445.1 1.2%

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
12,345.1 16,409.0 157,399 78.4 0.1 43.6 32.6% module write all entrypoints to disk (1%)
3,564.6 3,667.6 28,948 123.1 0.2 137.3 9.4% analyze ecmascript module module (66%)
2,858.5 5,858.4 46,161 61.9 0.1 25.6 7.5% process module module (16%)
2,691.5 2,853.0 51,515 52.2 0.0 21.6 7.1% internal resolving resolving (30%)
2,429.5 3,446.9 42,498 57.2 0.0 20.1 6.4% resolving module (20%)
2,067.0 2,194.5 8,006 258.2 0.8 77.6 5.5% parse ecmascript process module (28%)
1,831.7 2,934.6 18,498 99.0 0.4 66.7 4.8% code generation chunking (2%)
1,370.5 1,501.6 13,169 104.1 0.3 98.0 3.6% chunking write all entrypoints to disk (0%)
979.4 979.4 10,565 92.7 0.3 6.4 2.6% precompute code generation code generation (55%)
816.7 1,205.8 7,416 110.1 0.0 188.7 2.2% write all entrypoints to disk None (0%)
805.5 805.5 7,587 106.2 0.4 97.7 2.1% compute async module info chunking (0%)
650.3 650.7 7,259 89.6 0.1 60.2 1.7% compute async chunks webpack loader (0%)
409.8 422.9 1,058 387.3 1.9 23.3 1.1% webpack loader parse css (14%)
331.3 331.3 2,083 159.1 0.4 12.8 0.9% generate source map code generation (96%)
253.3 451.4 758 334.1 1.2 23.4 0.7% parse css module (6%)
127.8 127.8 2,341 54.6 0.1 13.5 0.3% read file parse ecmascript (91%)
74.0 74.0 840 88.1 0.0 20.8 0.2% compute binding usage info write all entrypoints to disk (1%)
30.7 30.7 1,793 17.1 0.0 7.0 0.1% collect mergeable modules compute merged modules (0%)
20.5 47.7 85 241.1 0.4 15.1 0.1% make production chunks chunking (6%)
20.4 27.0 651 31.4 0.1 2.7 0.1% async reference write all entrypoints to disk (1%)

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 137.4 2 process module → analyze ecmascript module
2 79.5 2 code generation → generate source map
3 77.7 2 process module → parse ecmascript
4 71.4 2 module → analyze ecmascript module
5 62.1 2 code generation → generate source map

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
No obvious batching candidates found - - - - -

Duration Distribution

Range Count Percentage
<10us 1,158,234 73.9%
10us-100us 382,262 24.4%
100us-1ms 20,294 1.3%
1ms-10ms 6,485 0.4%
10ms-100ms 470 0.0%
>100ms 4 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 8c08a2d into next May 6, 2026
52 of 58 checks passed
@fireairforce fireairforce deleted the fix-re-export-circular branch May 6, 2026 10:32
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.

[Utoopack] namespace export and circular dependencies cause runtime error

2 participants