Repository navigation
[Performance][Windows][0.2.1-rc.2] Cold web startup ~70 s: Defender first-access scanning + 51 duplicated zod copies (controlled experiments) #10982
Replies: 1 comment
Reply draft for Discussion #10982
Confirmation on 0.2.1-rc.5 + version delta (0.2.0-rc.2 → rc.5)Independent reproduction on the current
This is the rc.5 counterpart of the OP's 4.9 s → 70.8 s cold / 4.6 s → 2.3 s warm numbers: Module-load instrumentation on rc.5 (
Dumping the distinct zod URLs of one boot: 3,571 unique URLs but only 95 distinct zod Declared ranges in the rc.5 install: Extra data points1. Dedupe effect on rc.5 with real directories (not junctions). Replaced the 50 nested 2. 3. Fix suggestion (short term). The exact pins are the trigger; relaxing them in the Repro on rc.5: npm i -g @deepseek-ai/dsh@0.2.1-rc.5
DSH_HOME=$(mktemp -d) dsh web --no-open --port 3099 # time until "dsh web: http://…"
find "$(npm root -g)/@deepseek-ai/dsh/node_modules" -type d -name zod | wc -l # 51中文摘要在 0.2.1-rc.5(npm 当前
|
Uh oh!
There was an error while loading. Please reload this page.
Summary
On Windows 11, a cold
npx @deepseek-ai/dsh webtook 70.8 s to TCP listen: 59.7 s in the dsh process itself and 11.0 s in npx. A warm baseline run took 4.9 s; the instrumented warm reference was 5.3 s. Two controlled experiments:The cold cost is dominated by cold file I/O and Defender scanning of the unbundled module graph; the duplicated zod packages amplify the number of file operations. In these runs, npx was a separate 4–11 s component.
This is a controlled follow-up to #5807 (0.1.2-rc.1, synchronous file reads. The new parts are a Defender exclusion A/B/A on 0.2.1-rc.2 and a zod dedupe measurement; #10847/#9399 identified the exact pins and duplicate copies, and #7306 covers the separate npx stall.
中文摘要
在 Windows 11 上,冷启动
npx @deepseek-ai/dsh web到 TCP 监听耗时 70.8 秒,其中 dsh 进程自身 59.7 秒,npx 11.0 秒;热启动基线为 4.9 秒,带模块探针的热参考为 5.3 秒。两组对照实验如下:冷启动开销主要来自未打包模块图的冷文件 I/O 与 Defender 扫描;重复的 zod 包放大了文件操作数量。在上述运行中,npx 另有 4–11 秒的独立开销。
本文是对 #5807 的受控跟进:该帖在 0.1.2-rc.1 上报告了同步文件读取导致冷启动慢;本文在 0.2.1-rc.2 上补充了 Defender 排除 A/B/A 和 zod 去重测量。#10847/#9399 指出了精确 pin 和重复副本,#7306 涉及独立的 npx 卡顿。
Environment
latest;next= 0.2.1-rc.3)npx @deepseek-ai/dsh web(the dedupe copy was launched directly; see Method)%LOCALAPPDATA%\npm-cache\_npx\<hash>(published npm package)web; no MCP; workspace 12 files; sessions 1.9 MBMethod
I measured time to TCP listen, not UI-ready. The primary cold command was
npx @deepseek-ai/dsh web --port 3099 --no-open; the test port avoided a second instance on 3080. In the dedupe experiment, the unmodified install was launched the same way, while the deduped copy was launched directly withnode <copy>\node_modules\@deepseek-ai\dsh\lib\bin.js web --port 3099 --no-openbecause it is a separate install.Each condition began with a separate reboot, and the first cold run in each condition was the first dsh process after boot. In the dedupe condition, the unmodified install was measured first and the deduped copy's first run followed in the same session; that first dedupe run is the cold dedupe measurement because its path had not been touched since the reboot. No other installs were running in any reported run.
A local profiler records:
MSFT_NetTCPConnection.CreationTime)ReadOperationCount,ReadTransferCount,OtherOperationCountat listenmodule.registerHooks({ load })and--cpu-profThe instrumented warm run has hook overhead, so I use it for relative comparisons only.
Table terms:
dsh boot= dsh process start -> TCP listen;Total= npx start -> TCP listen.bytes=ReadTransferCount;other ops=OtherOperationCount(non-read/write I/O, including file metadata/query operations). All counters are sampled at listen.Experiment 1: Defender exclusion (baseline -> exclusion -> baseline)
I excluded the published install directory from Defender real-time scanning, then removed it and repeated the baseline. Same machine, same profile, separate reboots for each condition.
A vs B is the key comparison: the read counts are identical (11,619 vs 11,619) and the other-operation counts are essentially unchanged (125,365 vs 125,657), but dsh boot drops from 59.7 s to 11.1 s. A2 returns to 56.6 s under the same Defender signature version as B (both 1.461.196.0), so this is not a signature-update effect.
npxtime varied across these three runs (4.0–11.4 s), likely due to npm/npx cache and registry state; compare thedsh bootcolumn rather thanTotal. A2's read counts are ~12% lower and other ops ~8% lower than A/B, likely run-to-run variance.Notes:
node bin.jslaunch would separate dsh boot from npx; the exclusion + direct-launch combination is not covered by this data.Warm values in the table are from the instrumented rerun; the pure warm baseline run in A was 4.9 s. Use the warm values for relative comparisons.
Experiment 2: zod dedupe
The unmodified install has 51 physical zod copies: 50 packages pin
zodexactly to4.4.3, and the root has4.6.7. In a copy of the npm tree (the existing install was left untouched), I kept one real4.4.3copy and replaced the other 50 zod directories — including the root4.6.7— with directory junctions to it. All declared ranges accept 4.4.3 (the four^4.4.3packages included). This is an experiment, not a production recommendation — see caveats.The 49.5 s and 22.1 s are from the same reboot: the unmodified install was measured first, then the deduped copy was the first run of its own path. The deduped copy used a new path, so Defender may have been scanning it; the 22.1 s may therefore include extra first-access cost and is an upper bound on the dedupe cold time. Its immediate warm rerun was 2.3 s.
The 4.6 s warm value is the A2 baseline instrumented warm reference for the unmodified install; the 2.3 s value is the deduped copy's immediate rerun. They come from different boots, so treat the warm comparison as approximate.
Interpretation: dedupe reduces the amount of work (modules and I/O operations) and roughly halves both cold and warm times, but the cold/warm ratio stays around 10x (22.1 / 2.3) because the per-file cold/Defender-scanning cost remains. Defender exclusion removes the Defender component of the per-file cost (11.1 s with the same operation count). The two effects appear independent; whether they combine is an open question.
What I think this means
Caveats
Open questions / requests for guidance
zod@4.4.3pin as a security/supply-chain pin. I could not find a supported dedupe path. It would help to know whether a pnpm/overrides install is supported, or whether a release with bumped pins is planned.next) changes any of this, and what the safe upgrade/rollback path is.Further measurements that would help
The following measurements would make the picture more complete:
node bin.jslaunch, separating npx from the dsh process.Related: #5807 (earlier Windows cold-start analysis of synchronous file reads), #7306 (npx registry stall), #10847 (exact zod pins), #9399 (plugins carrying their own zod), #3320 (readiness before the plugin tree loads).
All reactions