Skip to content

feat: add long-haul, the worker-lifetime endurance app - #1

Merged
sheremet-va merged 1 commit into
mainfrom
feat/long-haul-app
Aug 3, 2026
Merged

feat: add long-haul, the worker-lifetime endurance app#1
sheremet-va merged 1 commit into
mainfrom
feat/long-haul-app

Conversation

@sheremet-va

Copy link
Copy Markdown
Member

Adds an app that measures what every existing fixture is structurally too short to see: worker-lifetime behavior. Motivated by the vm pool investigation behind vitest-dev/vitest#10854, where a 638-file jsdom suite inverted several conclusions this suite's small apps suggest.

What it is

80 jsdom test files scheduled onto 2 workers, so each worker serves 40 files in one process. Every file's world holds a ~15MB module-level dataset and renders DOM tables over it. The committed config pins vmMemoryLimit: 512MB, so vm pool workers are recycled several times per run on any machine instead of depending on the host's total memory.

What it measures

  • Long-run amortization: node pools rebuild the environment and re-import externalized dependencies for every file; vm pool workers pay once and reuse compiled scripts across contexts. This is the first app where the vm pools win by a wide margin (5.9s vs 19.2s against forks on jsdom, Apple M4), the counterweight to the small fixtures where they lose on startup cost.
  • The recycle path: no other app ever recycles a worker. A regression that makes recycling expensive (on vmThreads it tears the isolate down in-process, running a full GC over the dead worker's heap) lands in this table.

What it deliberately does not measure

World retention. Workers report lazy heapUsed to the memory-limit check, and V8 collects on its own schedule, so wall clock at this scale cannot distinguish a vitest that releases finished worlds from one that leaks them; that verification lives in Vitest's own reachability regression test (vitest-dev/vitest#10854). The generator header documents this so the fixture's claims stay honest.

Numbers for the README table come from pnpm bench --apps long-haul --runs 3 against the pinned 4.1.10. A run against the #10854 branch build produces the same shape (vm rows within noise, vmForks + happy-dom improves 5.67s to 4.84s).

80 jsdom test files through 2 workers so each worker serves 40 files.
Every file's world holds a ~15MB module-level dataset and renders DOM
tables over it, and the committed config pins vmMemoryLimit to 512MB so
vm workers recycle several times per run on any machine.

Short fixtures structurally understate worker-lifetime behavior: node
pools rebuild the environment and re-import externalized dependencies
for every file, while vm pool workers amortize both across their run
and periodically pay for recycling. This is the first app where the vm
pools win by a wide margin (5.9s vs 19.2s on jsdom) and the first one
that enters the worker recycle path at all.

World retention is deliberately out of scope: workers report lazy heap
numbers, so leak regressions belong to Vitest's own reachability tests
rather than wall clock.
@sheremet-va
sheremet-va merged commit ae91dac into main Aug 3, 2026
1 check passed
@sheremet-va
sheremet-va deleted the feat/long-haul-app branch August 3, 2026 15:08
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