perf(pack): accelerate large-graph HMR updates#3241
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors Hot Module Replacement (HMR) client state management by extracting core operations into a new helper module, hmrClientState.ts, and introduces comprehensive unit tests in hmr.test.ts to verify client delivery and subscription lifecycles. Feedback on the changes suggests avoiding direct parameter mutation of the payload object in enqueueTurbopackUpdateForClient to prevent unexpected side effects, and catching potential promise rejections when calling subscription.return?.() to avoid unhandled promise rejections.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
本轮 HMR 安全加固已推送:按 WebSocket/client 精确分发更新,构建期 batch 合并;Node/WASM 增加 expectedVersion 与 validation token 握手;WebSocket 自动重连并恢复订阅;WASM 订阅支持 generation/unsubscribe/RootTask dispose;dev/watch/hot=false 保持旧构建语义。新增 8 个 Chromium HMR 竞态回归并接入 pack CI。验证:Pack 76/76、pack-shared 6/6、HMR E2E repeat 3 为 24/24、动态列表快照 2/2、WASM 完整构建、@utoo/web tsc、相关 cargo check/clippy 均通过。 |
|
已同步最新 next(包含 #3251 的多微前端 HMR runtime 隔离)并解决冲突:保留按 chunk loading global 动态生成 listener global,同时保留本 PR 的 dev/watch/hot gating 与 scoped HMR。合并后再次验证 Pack 76/76、Chromium HMR E2E 8/8、@utoo/web tsc、@utoo/pack 本地 binding build 均通过;PR 已恢复可合并,最新 CI 已触发。 |
…nt-scoping # Conflicts: # packages/pack/src/commands/build.ts # packages/pack/src/core/hmr.ts # packages/pack/src/utils/env.ts
📊 Performance Benchmark Report (with-antd)Utoopack Performance ReportReport ID: Executive Summary
Build Phase TimelineShows when each build phase is active and how much CPU it consumes.
Workload Distribution by Diagnostic Tier
Top 20 Tasks by Self-TimeSelf-time is the exclusive duration: time spent in the task itself, not in sub-tasks.
Critical Path AnalysisThe longest sequential dependency chains that determine wall-clock time.
Batching CandidatesHigh-volume tasks dominated by a single parent. If the parent can batch them,
Duration Distribution
Action Items
Report generated by Utoopack Performance Analysis Agent |
Summary
Root causes
Ant Design exposes a large eager documentation graph. Its entry HMR chunk list contained 4,628 chunks, and each same-resource subscription previously created another iterator whose updates were broadcast to every socket. A development cache snapshot could also serialize about 138k tasks while a small Markdown update was waiting.
The new dynamic-list mode keeps the entry list at two directly generated chunks and lets loaded dynamic groups register their own lists. Client delivery is now one shared source fanned out only to actual subscribers. dumi can disable background snapshots and eviction only for its scoped demo-HMR mode; all existing Utoopack defaults remain unchanged.
Related changes
Validation
Compatibility
Global BUILDING, BUILT, and SYNC broadcasts remain unchanged. Background persistence and full memory eviction retain their previous defaults unless a consumer explicitly opts out.