Skip to content

fix(pack): add & as escape chunk filename character#2907

Merged
fireairforce merged 1 commit into
nextfrom
fix-pack-escape-character
May 7, 2026
Merged

fix(pack): add & as escape chunk filename character#2907
fireairforce merged 1 commit into
nextfrom
fix-pack-escape-character

Conversation

@fireairforce
Copy link
Copy Markdown
Member

Summary

Should not bundle & into output chunk filename, it will cause cdn link failed(character translation)

ref pr: utooland/next.js#146

Test Plan

add snapshot test case

@fireairforce fireairforce requested review from elrrrrrrr and xusd320 May 7, 2026 06:27
@fireairforce fireairforce force-pushed the fix-pack-escape-character branch from 774a97c to 0436ebd Compare May 7, 2026 06:27
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 filename escaping for chunks and assets to handle special characters such as '&', supported by a new snapshot test. The review feedback highlights that the escaping logic is inconsistently applied, specifically missing in default code paths where no filename template is provided, and notes a redundant escaping operation in one instance.

Comment thread crates/pack-core/src/library/chunking_context.rs
Comment thread crates/pack-core/src/library/chunking_context.rs
Comment thread crates/pack-core/src/library/chunking_context.rs
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20260507_064420
Generated: 2026-05-07 06:44:20
Trace File: trace_antd.json (0.5GB, 1.57M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 11,680.4 ms Baseline
Total Thread Work (de-duped) 40,716.1 ms Non-overlapping busy time
Effective Parallelism 3.5x thread_work / wall_time
Working Threads 5 Threads with actual spans
Thread Utilization 69.7% 🆗 Average
Total Spans 1,565,971 All B/E + X events
Meaningful Spans (>= 10us) 333,249 (21.3% of total)
Tracing Noise (< 10us) 1,232,722 (78.7% 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 74,669 7,150.7 5,747.8 8,925.1
Parse 9,399 3,318.2 2,845.6 11,548.3
Analyze 201,511 30,609.3 22,089.8 11,231.0
Chunk 14,103 1,877.9 1,738.2 8,931.8
Codegen 27,746 3,764.6 2,779.8 8,990.8
Emit 39 45.6 22.6 8,976.2
Other 5,782 1,918.3 1,479.3 11,680.4

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 279,674 39,039.6 95.9% 28,697.8 70.5%
P1: I/O & Heavy Tasks 3,034 232.3 0.6% 209.4 0.5%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 49,597 8,844.2 21.7% 7,247.3 17.8%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 944 568.2 1.4% 548.6 1.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
13,917.9 18,822.2 130,533 106.6 0.1 38.6 34.2% module write all entrypoints to disk (1%)
4,379.5 4,416.0 26,375 166.0 0.2 257.2 10.8% analyze ecmascript module module (67%)
3,128.0 3,345.6 40,833 76.6 0.0 25.8 7.7% internal resolving resolving (31%)
3,001.0 6,548.3 38,075 78.8 0.0 26.8 7.4% process module module (14%)
2,608.4 3,793.7 33,186 78.6 0.0 19.7 6.4% resolving module (15%)
2,326.3 2,495.0 6,392 363.9 1.1 45.4 5.7% parse ecmascript process module (35%)
1,629.7 2,614.5 16,258 100.2 0.4 60.2 4.0% code generation chunking (1%)
1,199.2 1,308.8 11,120 107.8 0.3 74.7 2.9% chunking write all entrypoints to disk (0%)
887.6 1,290.7 4,325 205.2 0.1 141.9 2.2% write all entrypoints to disk None (0%)
827.6 827.6 9,404 88.0 0.3 9.5 2.0% precompute code generation code generation (60%)
698.8 698.8 5,460 128.0 0.4 88.6 1.7% compute async module info chunking (0%)
515.6 516.0 2,921 176.5 0.2 36.5 1.3% compute async chunks webpack loader (0%)
499.9 513.3 857 583.3 3.6 27.1 1.2% webpack loader parse css (17%)
344.0 647.7 662 519.6 2.2 36.1 0.8% parse css module (7%)
322.5 322.5 2,084 154.7 0.4 16.4 0.8% generate source map code generation (96%)
175.3 175.3 2,340 74.9 0.0 18.1 0.4% read file parse ecmascript (91%)
59.0 59.0 694 85.0 0.0 15.8 0.1% compute binding usage info write all entrypoints to disk (0%)
43.1 59.4 513 83.9 0.1 6.1 0.1% async reference write all entrypoints to disk (1%)
23.4 53.0 62 377.5 0.6 17.3 0.1% make production chunks chunking (6%)
22.4 22.4 36 621.0 3.3 7.1 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 257.3 2 process module → analyze ecmascript module
2 80.0 2 module → analyze ecmascript module
3 76.6 2 code generation → generate source map
4 50.3 2 process module → analyze ecmascript module
5 45.4 2 process module → parse ecmascript

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,232,722 78.7%
10us-100us 307,385 19.6%
100us-1ms 18,215 1.2%
1ms-10ms 6,940 0.4%
10ms-100ms 703 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 merged commit 4253081 into next May 7, 2026
33 checks passed
@fireairforce fireairforce deleted the fix-pack-escape-character branch May 7, 2026 07:19
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