Skip to content

fix(pack): import_usage for functions behind member expressions#2900

Merged
fireairforce merged 2 commits into
nextfrom
fix-inner-graph-member-call
May 6, 2026
Merged

fix(pack): import_usage for functions behind member expressions#2900
fireairforce merged 2 commits into
nextfrom
fix-inner-graph-member-call

Conversation

@fireairforce
Copy link
Copy Markdown
Member

Summary

align turbopack's change: vercel/next.js#93504

fix business runtime error from scope hositing:

image

Test Plan

add snapshot test case

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 introduces a new snapshot test case to verify how module concatenation handles naming conflicts between exported and local variables. The test includes several input modules with overlapping variable names and asserts the correct renaming in the concatenated output. Additionally, the next.js subproject has been updated. I have no feedback to provide.

@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_094809
Generated: 2026-05-06 09:48:09
Trace File: trace_antd.json (0.5GB, 1.57M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 12,613.9 ms Baseline
Total Thread Work (de-duped) 30,125.1 ms Non-overlapping busy time
Effective Parallelism 2.4x thread_work / wall_time
Working Threads 5 Threads with actual spans
Thread Utilization 47.8% ⚠️ Suboptimal
Total Spans 1,567,562 All B/E + X events
Meaningful Spans (>= 10us) 363,839 (23.2% of total)
Tracing Noise (< 10us) 1,203,723 (76.8% 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 82,147 3,352.5 2,646.4 6,247.1
Parse 10,064 2,427.7 1,997.0 12,489.1
Analyze 218,195 18,465.2 13,289.1 12,097.6
Chunk 17,373 2,983.7 2,782.2 8,885.8
Codegen 29,195 5,316.0 4,012.8 9,004.7
Emit 39 57.4 28.5 9,185.3
Other 6,826 1,554.8 1,296.2 12,613.9

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 304,713 22,891.4 76.0% 16,768.7 55.7%
P1: I/O & Heavy Tasks 3,074 309.9 1.0% 281.1 0.9%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 55,001 10,569.0 35.1% 8,633.7 28.7%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 1,051 387.0 1.3% 368.8 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
7,534.0 10,476.7 143,346 52.6 0.1 35.2 25.0% module write all entrypoints to disk (1%)
2,726.1 2,753.0 27,719 98.3 0.2 212.2 9.0% analyze ecmascript module module (66%)
2,309.0 3,612.2 17,299 133.5 0.4 57.0 7.7% code generation chunking (1%)
1,922.1 2,086.8 11,115 172.9 0.4 65.3 6.4% chunking write all entrypoints to disk (0%)
1,771.1 3,937.7 40,182 44.1 0.0 20.1 5.9% process module module (14%)
1,477.7 1,715.6 7,059 209.3 0.7 36.2 4.9% parse ecmascript process module (31%)
1,428.7 1,538.0 45,221 31.6 0.0 20.0 4.7% internal resolving resolving (29%)
1,277.4 1,277.4 9,813 130.2 0.4 11.0 4.2% precompute code generation code generation (58%)
1,207.0 1,803.8 36,241 33.3 0.0 19.0 4.0% resolving module (14%)
1,118.2 1,118.2 5,893 189.7 0.7 103.4 3.7% compute async module info chunking (0%)
909.7 1,144.7 5,136 177.1 0.0 167.6 3.0% write all entrypoints to disk None (0%)
830.0 830.3 6,162 134.7 0.1 55.0 2.8% compute async chunks webpack loader (0%)
426.5 426.5 2,083 204.7 0.5 17.1 1.4% generate source map code generation (96%)
320.4 329.6 952 336.6 1.5 15.9 1.1% webpack loader parse css (12%)
277.4 470.2 655 423.5 2.2 18.7 0.9% parse css module (7%)
241.7 241.7 2,340 103.3 0.2 15.1 0.8% read file parse ecmascript (91%)
83.5 83.5 719 116.1 0.0 17.4 0.3% compute binding usage info write all entrypoints to disk (0%)
38.0 38.0 316 120.1 0.0 16.9 0.1% collect mergeable modules compute merged modules (0%)
30.2 66.5 96 314.1 0.7 17.8 0.1% make production chunks chunking (5%)
28.2 28.2 36 782.8 4.3 9.0 0.1% write file apply effects (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 212.3 2 process module → analyze ecmascript module
2 86.3 2 module → analyze ecmascript module
3 74.1 2 code generation → generate source map
4 41.9 2 module → analyze ecmascript module
5 41.8 2 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
No obvious batching candidates found - - - - -

Duration Distribution

Range Count Percentage
<10us 1,203,723 76.8%
10us-100us 339,323 21.6%
100us-1ms 18,836 1.2%
1ms-10ms 5,380 0.3%
10ms-100ms 294 0.0%
>100ms 6 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) May 6, 2026 09:48
@fireairforce fireairforce merged commit cad8c92 into next May 6, 2026
45 checks passed
@fireairforce fireairforce deleted the fix-inner-graph-member-call branch May 6, 2026 09:59
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