Skip to content

perf(vite): speed up inspect and stop storing sourcemaps - #617

Merged
webfansplz merged 1 commit into
mainfrom
vite-devtools-perf
Oct 21, 2026
Merged

webfansplz merged 1 commit into
mainfrom
vite-devtools-perf

Conversation

@webfansplz

Copy link
Copy Markdown
Member

1. Stop recording sourcemaps

  • The hook wrappers no longer read result.map. The store no longer stringifies, writes, reads, or parses sourcemaps.
  • Why: Nothing reads them. No UI, kit, or package code uses sourcemaps, yet every transform paid for JSON.stringify, archive writes, and a JSON.parse + larger RPC payload on read. Sourcemaps are often the largest field.

2. Lower per-hook cost in hijack.ts

  • Sync hooks stay sync. A .then chain is only attached when the hook returns a thenable.
  • Modules excluded by ctx.filter (or with no env context) call the original hook directly, with no timing.
  • Timing uses performance.timeOrigin + performance.now(). It is still epoch ms, but with sub-ms precision.
  • Why: This is the only cost on the transform hot path. The old wrapper was always async, which added a promise and a microtask to every sync resolveId / load / transform call (modules × plugins). Date.now() also recorded most hooks as 0ms.

3. Keep records when archive writes fail

  • Payload archive: when a write fails, the failed batch and every later payload are kept in an in-memory map keyed by offset. Reads check memory first, and reclaimed ranges are cleared.
  • Plugin-call archive: since it is append-only, every position after the failure is served from memory.
  • A new VDT0004 warning is emitted once per archive (docs page + index row added).
  • Why: Before, a single write failure (e.g. disk full) set lastWriteError, and every later record was silently dropped. A transform can't be reproduced, so data must not be lost.

Copilot AI balanced review requested due to automatic review settings October 21, 2026 04:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@617

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@617

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@617

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@617

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@617

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@617

commit: 688bad4

@webfansplz
webfansplz merged commit eda6b67 into main Oct 21, 2026
10 checks passed
@webfansplz
webfansplz deleted the vite-devtools-perf branch October 21, 2026 06:37
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.

2 participants