Skip to content

fix(pack): consume Turbopack free-variable analysis for JSX providers - #3431

Merged
fireairforce merged 5 commits into
nextfrom
zoomdong/fix-classic-react-binding
Oct 30, 2026
Merged

fireairforce merged 5 commits into
nextfrom
zoomdong/fix-classic-react-binding

Conversation

@fireairforce

@fireairforce fireairforce commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Fix React is not defined in classic JSX when provider.React is configured, including the equivalent case for custom JSX factories.

Update the next.js submodule to consume the Turbopack free-variable analysis fix. It identifies unbound transformed references during existing AST traversal so providers can resolve them. Add browser and Node regression snapshots using dummy runtimes.

Validation:

  • Seven focused analyzer tests, browser/Node snapshots, and 52 execution cases passed; formatting and Clippy passed.
  • Full Turbopack library: 599/603 tests passed, with four preexisting snapshot mismatches.
  • Synthetic benchmarks (12 interleaved rounds per workload) showed timing and peak RSS differences comparable to measurement variation.

Co-authored-by: Sisyphus <sisyphus@opencode.ai>
@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-30T03:45:33.995557Z 5d79456 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.

Co-authored-by: Sisyphus <sisyphus@opencode.ai>
@fireairforce fireairforce changed the title fix(pack): resolve classic JSX React references through providers fix(pack): consume Turbopack free-variable analysis for JSX providers Oct 30, 2026
Update the Turbopack submodule to reuse import analysis instead of running two extra AST traversals for transformed globals.

Co-authored-by: Sisyphus <sisyphus@opencode.ai>
@fireairforce
fireairforce enabled auto-merge (squash) October 30, 2026 06:07
@fireairforce
fireairforce disabled auto-merge October 30, 2026 06:11
Pin next.js to the merged utoo revision containing the transformed free-variable fix. Its source tree matches the previously validated feature commit.
@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20261030_062827
Generated: 2026-10-30 06:28:27
Trace File: trace_antd.json (0.3GB, 0.85M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 7,473.6 ms Baseline
Total Thread Work (de-duped) 23,257.3 ms Non-overlapping busy time
Effective Parallelism 3.1x thread_work / wall_time
Working Threads 10 Threads with actual spans
Thread Utilization 31.1% ⚠️ Suboptimal
Total Spans 846,370 All B/E + X events
Meaningful Spans (>= 10us) 198,715 (23.5% of total)
Tracing Noise (< 10us) 647,655 (76.5% 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,019 5,658.9 1,511.3 2,776.4
Parse 8,179 1,188.3 887.3 5,413.2
Analyze 132,444 36,443.2 7,851.6 5,329.8
Chunk 5,126 5,136.5 785.8 2,285.3
Codegen 9,274 2,120.0 1,354.5 1,948.6
Emit 29 40.5 20.3 8.2
Other 2,644 13,397.9 9,254.1 7,473.5

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 173,793 42,652.8 183.4% 9,648.6 41.5%
P1: I/O & Heavy Tasks 2,777 104.1 0.4% 83.9 0.4%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 21,041 8,454.9 36.4% 3,025.8 13.0%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 1,104 12,773.4 54.9% 8,906.6 38.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
7,826.5 7,897.0 16 489159.1 1,567.6 1,953.1 33.7% save snapshot persist (6%)
3,962.8 21,733.1 89,936 44.1 0.1 25.6 17.0% module module (60%)
1,866.0 1,976.8 2,501 746.1 2.5 184.9 8.0% analyze ecmascript module module (70%)
1,239.1 11,717.4 31,496 39.3 0.1 6.6 5.3% process module process module (80%)
1,001.2 2,733.5 22,120 45.3 0.1 3.5 4.3% internal resolving internal resolving (72%)
831.0 1,132.0 6,003 138.4 0.5 40.1 3.6% parse ecmascript parse ecmascript (66%)
780.7 847.9 7,193 108.5 0.4 5.9 3.4% precompute code generation generate merged code (52%)
685.1 827.4 6,102 112.3 0.4 152.5 2.9% compute async module info compute async module info (53%)
648.3 4,845.5 3,969 163.3 0.2 40.5 2.8% chunking chunking (60%)
636.8 2,034.2 875 727.7 1.7 239.3 2.7% generate merged code chunking (56%)
502.9 2,918.1 18,327 27.4 0.0 3.2 2.2% resolving module (64%)
395.2 395.2 329 1201.2 0.9 233.6 1.7% generate source map code generation (83%)
353.2 724.7 130 2716.6 4.3 215.0 1.5% emit code generate merged code (42%)
325.7 550.7 1,139 286.0 0.1 196.9 1.4% write all entrypoints to disk write all entrypoints to disk (9%)
178.6 876.9 1,752 101.9 0.2 51.9 0.8% code generation code generation (82%)
134.2 287.4 1,103 121.7 0.1 23.5 0.6% compute async chunks compute async chunks (45%)
71.7 71.7 7 10238.5 45.1 61.9 0.3% blocking save snapshot (57%)
56.3 56.3 2,173 25.9 0.0 1.0 0.2% read file parse ecmascript (91%)
54.5 66.5 638 85.4 0.0 33.1 0.2% compute binding usage info compute binding usage info (53%)
31.5 58.3 1,755 18.0 0.0 10.8 0.1% 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 2,015.0 3 persist → save snapshot → blocking
2 454.9 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 278.8 4 chunking → generate merged code → emit code → generate source map
4 185.4 9 module → module → process module → ... → process module → analyze ecmascript module → analyze ecmascript module
5 177.0 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 31,496 process module (80%) 39.3 us 0.06 ms 1,239.1 ms
internal resolving 22,120 internal resolving (72%) 45.3 us 0.08 ms 1,001.2 ms

Duration Distribution

Range Count Percentage
<10us 647,655 76.5%
10us-100us 126,245 14.9%
100us-1ms 62,868 7.4%
1ms-10ms 9,393 1.1%
10ms-100ms 173 0.0%
>100ms 36 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) October 30, 2026 08:06
@fireairforce
fireairforce merged commit 8dc23e6 into next Oct 30, 2026
95 checks passed
@fireairforce
fireairforce deleted the zoomdong/fix-classic-react-binding branch October 30, 2026 08:49
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