Skip to content

fix(pack): cover merged re-exports from shared modules - #3393

Merged
fireairforce merged 1 commit into
nextfrom
zoomdong/fix-scope-hoist-import-binding
Sep 26, 2026
Merged

fireairforce merged 1 commit into
nextfrom
zoomdong/fix-scope-hoist-import-binding

Conversation

@fireairforce

@fireairforce fireairforce commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Add a concatenate_modules regression fixture for a shared import re-exported through multiple merged barrels. The fixture executes the emitted module factories and reads the re-export getters. Before the Turbopack fix, it throws the unbound __TURBOPACK__imported__module__* ReferenceError seen in imall-main.

Update the next.js submodule to a787299fbf, the merged fix from utooland/next.js#196. This PR is rebased onto next after #3391 merged.

Verification

  • cargo test -p pack-tests --test snapshot concatenate_modules -- --nocapture (6 passed on the rebased commit)
  • cargo fmt --check in the next.js submodule
  • cargo clippy --all-targets -- -D warnings --no-deps in the next.js submodule on the equivalent pre-merge patch
  • Full imall-main production build with the patched release-local native binding and affected dependency versions succeeded. A Babel scope scan of all 932 JS output files found zero unbound generated import identifiers; the same scan found two in the original build.

Base automatically changed from zoomdong/fix-runtime-public-path to next September 26, 2026 09:38
@fireairforce
fireairforce force-pushed the zoomdong/fix-scope-hoist-import-binding branch from b46f553 to 22bdcbc Compare September 26, 2026 09:48
@fireairforce
fireairforce marked this pull request as ready for review September 26, 2026 09:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 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-09-26T09:53:28.020822Z 22bdcbc Draft marked ready
ℹ️ 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.

@PeachScript PeachScript left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20260926_100618
Generated: 2026-09-26 10:06:18
Trace File: trace_antd.json (0.3GB, 0.83M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 5,966.1 ms Baseline
Total Thread Work (de-duped) 17,910.8 ms Non-overlapping busy time
Effective Parallelism 3.0x thread_work / wall_time
Working Threads 10 Threads with actual spans
Thread Utilization 30.0% ⚠️ Suboptimal
Total Spans 826,031 All B/E + X events
Meaningful Spans (>= 10us) 196,974 (23.8% of total)
Tracing Noise (< 10us) 629,057 (76.2% 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,449 5,429.9 1,462.5 2,668.1
Parse 8,154 1,253.7 933.9 5,164.0
Analyze 127,060 35,660.9 7,500.4 5,079.3
Chunk 5,281 5,274.6 843.0 2,174.2
Codegen 11,812 2,047.2 1,321.3 1,875.5
Emit 34 31.3 15.7 6.4
Other 3,184 7,263.2 4,265.4 5,966.0

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 169,149 41,567.7 232.1% 9,145.3 51.1%
P1: I/O & Heavy Tasks 2,700 90.3 0.5% 74.7 0.4%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 23,829 8,624.2 48.2% 3,132.9 17.5%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 1,296 6,678.7 37.3% 3,989.3 22.3%

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,630.9 20,612.3 85,152 42.6 0.1 11.9 20.3% module module (60%)
2,866.6 3,054.1 18 159254.2 319.2 594.7 16.0% save snapshot persist (6%)
1,806.8 1,926.6 2,532 713.6 2.2 242.7 10.1% analyze ecmascript module module (69%)
1,246.9 12,126.1 30,829 40.4 0.1 4.8 7.0% process module process module (81%)
969.7 2,603.5 22,454 43.2 0.1 4.0 5.4% internal resolving internal resolving (73%)
880.5 1,200.3 5,994 146.9 0.6 40.0 4.9% parse ecmascript parse ecmascript (66%)
731.1 4,986.6 3,966 184.3 0.2 125.2 4.1% chunking chunking (45%)
724.5 796.5 9,703 74.7 0.3 6.0 4.0% precompute code generation generate merged code (42%)
684.8 770.6 6,039 113.4 0.4 109.8 3.8% compute async module info compute async module info (51%)
584.5 1,906.4 1,032 566.4 1.3 197.2 3.3% generate merged code chunking (47%)
487.2 2,820.9 18,489 26.4 0.0 4.9 2.7% resolving module (57%)
417.6 417.6 329 1269.2 0.8 243.3 2.3% generate source map code generation (83%)
321.2 722.7 130 2470.6 3.8 194.7 1.8% emit code generate merged code (42%)
261.8 491.9 1,495 175.1 0.1 135.4 1.5% write all entrypoints to disk write all entrypoints to disk (14%)
190.8 190.8 9 21194.8 95.4 144.8 1.1% blocking save snapshot (56%)
179.2 833.1 1,780 100.7 0.2 40.8 1.0% code generation code generation (83%)
109.4 284.9 1,282 85.3 0.1 11.0 0.6% compute async chunks compute async chunks (38%)
88.1 102.1 742 118.7 0.0 35.1 0.5% compute binding usage info compute binding usage info (49%)
53.4 53.4 2,157 24.8 0.0 3.0 0.3% read file parse ecmascript (92%)
31.9 58.0 1,744 18.3 0.0 12.1 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 739.6 3 persist → save snapshot → blocking
2 394.2 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 280.9 4 chunking → generate merged code → emit code → generate source map
4 268.3 2 save snapshot → blocking
5 242.8 3 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 30,829 process module (81%) 40.4 us 0.06 ms 1,246.9 ms
internal resolving 22,454 internal resolving (73%) 43.2 us 0.08 ms 969.7 ms

Duration Distribution

Range Count Percentage
<10us 629,057 76.2%
10us-100us 126,259 15.3%
100us-1ms 61,407 7.4%
1ms-10ms 9,111 1.1%
10ms-100ms 156 0.0%
>100ms 41 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 40e5c29 into next Sep 26, 2026
64 of 70 checks passed
@fireairforce
fireairforce deleted the zoomdong/fix-scope-hoist-import-binding branch September 26, 2026 14:23
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