Skip to content

feat(pack): add native browser module references - #3449

Merged
fireairforce merged 10 commits into
nextfrom
zoomdong/native-module-references
Nov 10, 2026
Merged

fireairforce merged 10 commits into
nextfrom
zoomdong/native-module-references

Conversation

@fireairforce

@fireairforce fireairforce commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Adds opt-in module.references to replace exact browser modules before parsing, loaders, or dependency traversal. Factories receive JSON data; Node builds and unconfigured applications retain their original behavior. Noncanonical resource registrations fail explicitly.

Covers aliases, symlink imports, barrel re-exports, queries, implementation isolation, and legacy browser output with live bindings and cycles. Includes the submodule fix in utooland/next.js#211. Framework integration: EVJS #162.

Validation: 17 focused native/capability/worker tests on Node 20, Rust check/clippy/fmt, and Biome passed.

@fireairforce
fireairforce force-pushed the zoomdong/native-module-references branch from cfead72 to ddfcb28 Compare November 10, 2026 05:22
@fireairforce
fireairforce marked this pull request as ready for review November 10, 2026 07:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T07:45:59.174752Z 863dd40 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.

@fireairforce
fireairforce force-pushed the zoomdong/native-module-references branch from 863dd40 to a73a1ca Compare November 10, 2026 08:38
@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20261110_102908
Generated: 2026-11-10 10:29:08
Trace File: trace_antd.json (0.3GB, 0.88M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 5,495.7 ms Baseline
Total Thread Work (de-duped) 16,836.4 ms Non-overlapping busy time
Effective Parallelism 3.1x thread_work / wall_time
Working Threads 10 Threads with actual spans
Thread Utilization 30.6% ⚠️ Suboptimal
Total Spans 879,322 All B/E + X events
Meaningful Spans (>= 10us) 193,328 (22.0% of total)
Tracing Noise (< 10us) 685,994 (78.0% 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 38,635 4,940.0 1,270.7 2,617.2
Parse 8,161 1,104.7 802.8 4,524.9
Analyze 128,232 36,862.9 6,787.2 4,471.8
Chunk 5,010 4,005.8 547.1 1,749.9
Codegen 11,149 1,735.0 1,111.3 1,742.5
Emit 28 35.0 17.5 7.6
Other 2,113 9,464.9 4,752.8 5,495.7

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 167,434 44,163.2 262.3% 8,425.1 50.0%
P1: I/O & Heavy Tasks 2,809 100.4 0.6% 82.9 0.5%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 22,155 6,802.4 40.4% 2,418.0 14.4%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 930 7,082.4 42.1% 4,363.4 25.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,025.1 23,573.5 97,322 41.4 0.1 21.4 23.9% module module (64%)
3,192.7 3,382.9 17 187806.2 496.5 755.8 19.0% save snapshot persist (6%)
1,699.2 1,777.1 2,150 790.3 2.4 185.1 10.1% analyze ecmascript module module (81%)
1,037.4 11,476.1 28,727 36.1 0.1 5.4 6.2% process module process module (81%)
837.4 2,417.9 21,392 39.1 0.1 7.0 5.0% internal resolving internal resolving (72%)
746.3 1,048.2 5,986 124.7 0.5 32.9 4.4% parse ecmascript parse ecmascript (66%)
608.1 679.1 9,077 67.0 0.2 6.8 3.6% precompute code generation generate merged code (67%)
605.1 1,836.8 699 865.7 2.0 200.0 3.6% generate merged code chunking (90%)
461.0 3,824.3 3,988 115.6 0.1 32.6 2.7% chunking chunking (24%)
424.4 2,513.2 16,637 25.5 0.0 6.0 2.5% resolving module (62%)
374.2 2,293.0 808 463.1 0.3 73.2 2.2% write all entrypoints to disk write all entrypoints to disk (13%)
355.3 355.3 329 1080.0 0.8 226.2 2.1% generate source map code generation (83%)
345.7 694.3 130 2659.2 3.6 208.2 2.1% emit code emit code (43%)
202.2 202.2 11 18378.2 93.3 179.5 1.2% blocking save snapshot (45%)
147.9 700.6 1,743 84.8 0.2 42.2 0.9% code generation code generation (83%)
82.8 177.8 969 85.5 0.1 8.1 0.5% compute async chunks compute async chunks (49%)
56.4 56.4 2,172 26.0 0.0 2.0 0.3% read file parse ecmascript (91%)
17.4 17.4 12 1450.7 5.1 5.5 0.1% write file apply effects (100%)
15.2 89.6 375 40.6 0.1 2.8 0.1% async reference async reference (42%)
13.3 13.3 10 1332.1 5.7 8.1 0.1% compute binding usage info write all entrypoints to disk (20%)

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 935.4 3 persist → save snapshot → blocking
2 411.0 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 263.2 4 chunking → generate merged code → emit code → generate source map
4 262.4 2 save snapshot → blocking
5 185.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 28,727 process module (81%) 36.1 us 0.05 ms 1,037.4 ms
internal resolving 21,392 internal resolving (72%) 39.1 us 0.07 ms 837.4 ms

Duration Distribution

Range Count Percentage
<10us 685,994 78.0%
10us-100us 121,665 13.8%
100us-1ms 63,068 7.2%
1ms-10ms 8,375 1.0%
10ms-100ms 177 0.0%
>100ms 43 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 43542b0 into next Nov 10, 2026
@fireairforce
fireairforce deleted the zoomdong/native-module-references branch November 10, 2026 12:57
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