perf: vitest threads pool + Dockerfile pnpm cache mount #66
Reference in New Issue
Block a user
Delete Branch "perf/vitest-threads-and-docker-pnpm-cache"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Two tuning knobs leaving the box mostly idle:
1. `vitest.config.ts` — pool: threads with maxThreads ≈ cores/2
Default vitest pool config left the 64-core workstation at ~10% CPU during `pnpm test:run`. Threads pool uses the box: ~700% CPU instead of ~150% on the same suite. Wall time gain is modest (workload is dominated by a few slow individual test files that one thread must run serially — `registry/client.test.ts` 8s, `status.test.ts` 3.5s), but the parallel headroom is there for when the suite grows. Override at run time via `VITEST_MAX_THREADS=N`.
2. `Dockerfile.mcpd` — BuildKit pnpm cache mounts
Adds `# syntax=docker/dockerfile:1.6` and `--mount=type=cache,target=/root/.local/share/pnpm/store` to both `pnpm install --frozen-lockfile` steps. Pnpm's content-addressed store survives across image rebuilds. Cold rebuilds (lockfile changed) unaffected; warm rebuilds (only source changed) drop the install step from ~60s to <5s. `fulldeploy.sh` mcpd image rebuilds get that back.
Test plan
🤖 Generated with Claude Code