Conversation
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://perf-config-resolution-viteplus-dev.voidzero-docs.workers.dev (commit 76ce17c)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
CLI artifact sizes (
|
| Artifact | Format | Base | PR | Change |
|---|---|---|---|---|
packages/cli/dist |
Directory total | 2.12 MiB | 2.12 MiB | +125 B (+0.01%) |
packages/core/dist |
Directory total | 3.95 MiB | 3.95 MiB | 0 B (0.00%) |
| Combined package dist | Directory total | 6.07 MiB | 6.07 MiB | +125 B (+0.00%) |
vp (Linux x64) |
Binary | 11.28 MiB | 11.28 MiB | 0 B (0.00%) |
vp (Linux x64) |
gzip -9 | 4.88 MiB | 4.88 MiB | 0 B (0.00%) |
| NAPI (Linux x64) | Binary | 32.11 MiB | 32.11 MiB | 0 B (0.00%) |
| NAPI (Linux x64) | gzip -9 | 12.74 MiB | 12.74 MiB | +691 B (+0.01%) |
vp (macOS ARM64) |
Binary | 8.41 MiB | 8.41 MiB | 0 B (0.00%) |
vp (macOS ARM64) |
gzip -9 | 4.26 MiB | 4.26 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | Binary | 39.72 MiB | 39.72 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | gzip -9 | 17.04 MiB | 17.04 MiB | +158 B (+0.00%) |
vp (Windows x64) |
Binary | 9.16 MiB | 9.16 MiB | 0 B (0.00%) |
vp (Windows x64) |
gzip -9 | 4.00 MiB | 4.00 MiB | +2 B (+0.00%) |
| NAPI (Windows x64) | Binary | 27.07 MiB | 27.07 MiB | +1.00 KiB (+0.00%) |
| NAPI (Windows x64) | gzip -9 | 10.84 MiB | 10.84 MiB | +210 B (+0.00%) |
| 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.56 MiB | 4.56 MiB | 0 B (0.00%) |
| Installer (Windows x64) | gzip -9 | 2.13 MiB | 2.13 MiB | 0 B (0.00%) |
7fe3395 to
76ce17c
Compare
|
Benchmark run for PR head 4 case(s) changed by more than ±5% in median time. Negative changes are faster; positive changes are slower. Config performanceBaseline revision: Current revision:
Fresh processes, warm filesystem and Node compile caches. Config logging is disabled during timing. |
There was a problem hiding this comment.
@fengmk2 Thanks for your working on that. Just wanna notice: according to my profile and a contributor's analyze, the main cost of a vp check run is actually vite-plus package's import for every single Oxlint & Oxfmt child process (70%~80%, about 200ms in reality), analyzing and loading Vite+ config itself only takes about 20% for now. Improving config resolver is good but cannot completely solve the biggest performance cost.
I suggest a possible solution: instead of calling Oxlint / Oxfmt as child process, we can load them in the same Node.js process (using ESM import), the JS runtime should reuse the first import automatically.
Alternatively, we can change Oxlint / Oxfmt's behavior, to stop forcing import vite-plus package, and let Vite's config loader remove defineConfig macro import. This approach is a bit more complicated.
This is just some personal ideas, haven't been tested or verified. However, if our goal is to just improve that as soon as possible, we can treat these stacks as a incremental improvements.
Profiling: https://github.com/liang-demos/vite-plus-config-import-bench#readme
|
@liangmiQwQ I was only trying to conduct some experiments; the data results were not ideal, so I have stopped. |
From a workspace package,
vp check --fixevaluates the Vite config seven times. Reuse its resolved config when selecting the config for each tool phase. This reduces evaluations to four and limits reuse to one command invocation.Load Vite and Vitest only when config resolution is necessary. Return empty metadata when the workspace has no Vite config. Existing config files still use the full Vite resolver, including config functions and plugin hooks.
Reduce the benchmark limit to one config evaluation per process.
Single-run comparison with
timeBefore:
a07ad93b9. After:76ce17ced. Each case ran once per version, without warmup. Both versions used debug native bindings on Apple M4 Max, macOS26.2, and Nodev22.23.2.The fixture contains three unformatted TypeScript files in
packages/app/src. Config cases useexport default { lint: {}, fmt: {} };. Each invocation starts with identical input files and an emptyNODE_COMPILE_CACHEdirectory.The before and after columns show
real / user / sysfrom/usr/bin/time -p, in seconds.check --fixcheck --fixfmtlint --fixcheck --fixExample invocation from the fixture root:
Set
$CHECKOUTto the before or after worktree. Point the fixture'snode_modules/vite-pluslink to that worktree'spackages/cli. Reset the input files before each invocation. Package cases run frompackages/appwithsrc/*.tsas the file arguments.Stacked on #2779. Related to #2698.