Skip to content

perf(cli): skip config runtime initialization when no config exists - #2922

Draft
fengmk2 wants to merge 2 commits into
mainfrom
perf/config-latest-main
Draft

fengmk2 wants to merge 2 commits into
mainfrom
perf/config-latest-main

Conversation

@fengmk2

@fengmk2 fengmk2 commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

vp check initializes Vite and Vitest to read metadata even when the selected workspace root has no vite.config.* file.

resolveUniversalViteConfig returns empty metadata when no supported config file exists. Otherwise, it passes the discovered path to Vite through configFile, which avoids a second filename search. resolveViteConfig loads define-config only when runtime resolution is necessary. Each call checks the filesystem, so later calls detect new config files. Existing configs retain runtime evaluation, plugin hooks, and error handling.

For vp check --fix on three TypeScript files, median elapsed time decreased by 14.8% (about 36 ms) without a config file.
The cases with a config file show no material performance change.

Case Before: ac5fab0d6 After: 48d1c9247 Change
No config 242.2 ms 206.4 ms -14.8%
Object literal config 367.9 ms 368.7 ms +0.2%
defineConfig 374.2 ms 377.3 ms +0.9%
Package directory with root config 366.9 ms 367.2 ms +0.1%
Plugin config hook 364.2 ms 364.0 ms ≈0%
Lint fixes with config 380.7 ms 372.9 ms -2.1%

For the no-config case, median /usr/bin/time -p real decreased from 0.24 s to 0.20 s.
The table uses a high-resolution wall clock; /usr/bin/time -p reports rounded values.

These local measurements used macOS arm64, an Apple M4 Max, Node 26.10.0, and the same release native binding.
Each variant ran in a fresh process with warm filesystem and Node compile caches.
The comparison used six warmups and fifteen measured rounds, with rotating execution order.
Identical-code controls differed from the baseline by at most 1.7% across these cases.

Related to #2698.


Stack created with GitHub Stacks CLI • Give Feedback 💬

`vp check` initializes Vite and Vitest to read metadata even when the selected workspace root has no `vite.config.*` file.

`resolveUniversalViteConfig` now returns empty metadata when no supported config file exists. This avoids unnecessary startup work. `resolveViteConfig` loads `define-config` only when runtime resolution is necessary. Each call checks the filesystem, so later calls detect new config files. Existing configs retain runtime evaluation, plugin hooks, and error handling.

Related to #2698.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://perf-config-latest-main-viteplus-dev.voidzero-docs.workers.dev (commit 48d1c92)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://dc651592-viteplus-dev.voidzero-docs.workers.dev 48d1c92 2026-10-07T09:24:46.998Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://399fe496-viteplus-dev.voidzero-docs.workers.dev e09c1af 2026-10-07T08:58:34.090Z Visit the dashboard ↗

This branch has not been deployed

No deployments
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.

1 participant