Repository navigation
Conversation
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://feat-vpx-warm-start-cache-prototype-viteplus-dev.voidzero-docs.workers.dev (commit 2c14029)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
515df7f to
19d7d80
Compare
CLI artifact sizes (
|
| Artifact | Format | Base | PR | Change |
|---|---|---|---|---|
packages/cli/dist |
Directory total | 2.33 MiB | 2.34 MiB | +7.22 KiB (+0.30%) |
packages/core/dist |
Directory total | 4.08 MiB | 4.08 MiB | 0 B (0.00%) |
| Combined package dist | Directory total | 6.41 MiB | 6.42 MiB | +7.22 KiB (+0.11%) |
vp (Linux x64) |
Binary | 8.31 MiB | 8.31 MiB | 0 B (0.00%) |
vp (Linux x64) |
gzip -9 | 3.80 MiB | 3.80 MiB | 0 B (0.00%) |
| NAPI (Linux x64) | Binary | 36.39 MiB | 36.45 MiB | +64.00 KiB (+0.17%) |
| NAPI (Linux x64) | gzip -9 | 14.55 MiB | 14.58 MiB | +30.15 KiB (+0.20%) |
vp (macOS ARM64) |
Binary | 5.42 MiB | 5.42 MiB | 0 B (0.00%) |
vp (macOS ARM64) |
gzip -9 | 3.23 MiB | 3.23 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | Binary | 43.01 MiB | 43.05 MiB | +48.59 KiB (+0.11%) |
| NAPI (macOS ARM64) | gzip -9 | 18.64 MiB | 18.67 MiB | +24.21 KiB (+0.13%) |
vp (Windows x64) |
Binary | 6.15 MiB | 6.15 MiB | 0 B (0.00%) |
vp (Windows x64) |
gzip -9 | 2.84 MiB | 2.84 MiB | +1 B (+0.00%) |
| NAPI (Windows x64) | Binary | 32.32 MiB | 32.38 MiB | +57.00 KiB (+0.17%) |
| NAPI (Windows x64) | gzip -9 | 13.23 MiB | 13.25 MiB | +25.77 KiB (+0.19%) |
| Trampoline (Windows x64) | Binary | 13.50 KiB | 13.50 KiB | 0 B (0.00%) |
| Trampoline (Windows x64) | gzip -9 | 7.09 KiB | 7.09 KiB | 0 B (0.00%) |
| Installer (Windows x64) | Binary | 4.66 MiB | 4.66 MiB | 0 B (0.00%) |
| Installer (Windows x64) | gzip -9 | 2.23 MiB | 2.23 MiB | 0 B (0.00%) |
|
Closing this prototype. The measured gains do not justify its storage, invalidation, and compatibility costs for the intended startup improvement. Follow-up experiments covered packed storage, smaller source maps, asynchronous writes, resolver changes, and a compiled module graph. The results below use later local changes beyond PR head Knip
Each mode used 120 fresh processes across two interleaved runs on an Apple M4 Max with Node.js The per-module cache reduced startup by 6.3% and complete scan time by 4.6%, relative to caching disabled. The graph cache reduced those times by 34.1% and 25.5%. Relative to per-module hits, the graph saved 29.7% and 21.9%. It did not meet the goal of reducing elapsed time by at least 50% on this real workload. The graph prototype reduced startup by 55.0% in a separate 10,000-module synthetic case. Time fell from 860.1 ms with per-module hits to 386.9 ms. The real-project result shows that this gain does not apply to every workload. The profiles explain the limited benefit of transform caching:
The graph cache combines Knip's static source modules. Third-party packages and native bindings remain external. Each hit includes source-content and configuration checks. Every launch performs a fresh scan. Adding an unused Marked source file changed the report while the graph still hit. The graph artifact adds about 2.2 MiB of storage. Its two cold runs exited after 589 and 707 ms, compared with 271 and 263 ms for the per-module cache. These are individual observations, not stable cold-start estimates. General dynamic-import and module-identity behavior still needs separate work. Caching can still help large files with expensive transforms. For the multi-module workloads measured here, further improvements should focus on module loading, V8 compilation, or process reuse. The current evidence does not support merging this cache prototype as a general startup-speed improvement. |
A fresh
vpxprocess repeats Oxc transforms and JavaScript compilation for unchanged scripts. SetVPX_CACHE=1to enable the Oxc transform cache and the Node.js compile cache. Each invocation still executes the script. Both caches are off by default. SetVPX_DISABLE_CACHE=1to disable both managed caches.The transform cache groups small records from the same source directory in one file. Large records use individual files. Vite Task excludes the cache directory from task inputs and outputs. The store has no automatic cleanup.
Knip scanning Marked
We ran Knip
6.44.2from its TypeScript source to check Marked18.1.3for unused production files and exports. Knip ran the analysis on every launch with its own cache off. Every mode reported the same five files. Knip source · Marked checkoutMedian times cover the full command from global
vpxlaunch through exit on an Apple M4 Max with Node.js24.22.2. The comparison uses PR base0bea91491and head2c140295c.VPX_CACHE=transformVPX_CACHE=1Each mode used 120 warm processes and 18 cold processes across two runs. Cold processes started with empty
vpxcaches. A separate warm launch recorded 428 transform-cache hits and zero misses.Command for the Knip scan
Run from the Knip checkout with Marked in the adjacent
markeddirectory.Startup performance
The tables show median time in milliseconds from global
vpxlaunch to script readiness on an Apple M4 Max with Node.js24.22.2. Before uses the PR base0bea91491. After uses2c140295cwith the indicated cache setting.With both caches enabled, warm startup took 37–40% less time for the large files and about 3% more time for the 300-module graphs.
Warm startup (60 fresh processes per case)
VPX_CACHE=transformVPX_CACHE=1Cold startup (7 fresh processes per case, each with an empty cache)
VPX_CACHE=1Packing reduced warm cache file opens from 304 to 2 on both 300-module graphs. Benchmark harness · Packed storage measurements
Scaling to 1,000 and 10,000 modules
One TypeScript entry imports every leaf from the same directory. Both package types use the same static imports and run every leaf before signaling readiness. Only the leaf count and expected sum change from the 300-module graphs. Fixture source
The table shows median milliseconds from global
vpxlaunch to readiness on an Apple M4 Max with Node.js24.22.2. The comparison uses PR base0bea91491and head2c140295c.Each mode used 40 warm launches at 1,000 leaves and 30 at 10,000. Each cold median used five launches with empty
vpxcaches.VPX_CACHE=transformselects the transform cache.VPX_CACHE=1enables both caches.At 1,000 leaves, the transform store used two packs and one individual file per graph. At 10,000 leaves, the source directory pack filled to within 1.5 KiB of its 4 MiB limit. Each graph also used 7,174–7,188 individual transform files. Warm diagnostics still recorded 10,004 hits and zero misses per launch. Pack limits and fallback
At 10,000 leaves with empty caches and both layers enabled, median time to process exit was 4.27 s for ESM and 4.35 s for the default package.