Repository navigation
Description
Problem
Nothing in this repository measures memory. The benchmark pipeline is time-shaped end to end, for both the TypeScript CLI and the Rust stacks, so a memory regression can only be caught by a user hitting it in production.
That is what happened with pnpm/pnpm#13077: concurrent workspace projects each re-serialized the same registry packument (~31 MB for a popular package), exhausting the V8 heap on large workspaces. It shipped, and CI had no way to see it.
pnpm/pnpm#13079 fixes that specific bug and carries a deterministic regression test for it. This issue is about the general gap.
Why CI cannot catch this class today
Concretely, verified against the current tree:
- No memory instrumentation exists anywhere. No
process.memoryUsage,process.resourceUsage,maxRSS,getrusage,/usr/bin/time -v, heap snapshots,dhat, orpeak_alloc. (The--max-old-space-sizehits underexec/are fixtures assertingNODE_OPTIONSpassthrough, unrelated.) - hyperfine cannot report memory. It emits
mean/stddev/median/user/system/min/max/times/exit_codesand has no memory capability at all. Both stacks' benchmarks are driven by it. - The transport cannot carry a memory measure. Every upload uses
--adapter shell_hyperfine(.github/workflows/benchmark.yml:128,.github/workflows/ci-performance-bencher-upload.yml:206), which parses hyperfine's time schema. - The orchestrator drops everything but the mean.
HyperfineCommandinpnpm/tasks/integrated-benchmark/src/work_env.rs:1139deserializescommand,command_name,mean.PhaseSummaryhas no byte-valued field. - Neither fixture is workspace-shaped.
pnpm11/benchmarks/fixture/has apackage.jsonand a lockfile and nopnpm-workspace.yaml. The orchestrator fixture (pnpm/tasks/integrated-benchmark/src/fixtures/) has apnpm-workspace.yaml, but it is settings-only (storeDir,supportedArchitectures,allowBuilds) with nopackages:key. Both are single-project-with-many-deps. The multi-project workspace install — pnpm's flagship shape, and the one that triggers this OOM class — is not benchmarked at all, for either stack. - The TS bench is not a PR gate.
benchmark.ymltriggers onworkflow_dispatchandpushtomainonly, so a regression surfaces after merge. (pacquet-integrated-benchmark.ymldoes run onpull_request, so the two stacks are asymmetric here.)
Point 5 is the important one: even with perfect memory instrumentation, the current fixtures could not have reproduced pnpm/pnpm#13077.
Proposal
1. A multi-project workspace fixture
Add a fixture with N projects sharing heavy dependencies, as a new scenario. This is what reproduces the fan-out: many projects resolving one package concurrently against a cold cache.
Worth doing on its own merits — it closes a wall-clock coverage gap too, not just a memory one, and it applies to both stacks.
2. Peak RSS, measured once in the shared orchestrator
pnpm/tasks/integrated-benchmark is driven by both pnpm11/benchmarks/bench.sh and pacquet-integrated-benchmark.yml, so instrumenting it once covers pnpm, pacquet, and pnpr.
Measure externally rather than per-language. Peak RSS of the process tree is comparable across both stacks and is the thing that actually OOMs; V8 heap statistics and Rust allocator counters are not comparable to each other. On Linux (where the benches run) that is /usr/bin/time -v, getrusage(RUSAGE_CHILDREN).ru_maxrss, or cgroup v2 memory.peak.
If per-language detail is wanted later: Node has process.resourceUsage().maxRSS (a true high-water mark, no sampling, no GC-timing noise) and Rust has getrusage(RUSAGE_SELF).ru_maxrss, plus dhat/peak_alloc for allocation-level profiling. sysinfo is already a workspace dependency, though currently used only for process killing.
3. Transport
Emit Bencher Metric Format and upload with --adapter json alongside the existing hyperfine upload, rather than extending the hyperfine schema. bench.sh already post-processes per-scenario JSON with jq into bencher-results.json, so a parallel BMF file is the smallest change that avoids touching the time path.
4. Record-only, then gate
Land the measure ungated. Peak RSS across runs is not aggregated by hyperfine at all, so the noise profile is unknown and max-of-runs vs. mean-of-maxima needs a decision informed by real data. Add a Bencher threshold once there is a baseline.
5. A hard heap cap for a binary signal
Run the workspace scenario under --max-old-space-size. An OOM regression then fails CI outright — no threshold tuning, no flake. This is the cheapest high-signal guard, but it is only meaningful once the fixture from (1) exists.
Notes
Thresholds on a memory measure are inherently noisier than the deterministic alternative. Where a regression has a specific, assertable mechanism, a unit test is the better guard — pnpm/pnpm#13079 asserts that concurrent resolutions perform zero re-serializations, which is deterministic and runs on every PR in well under a second. The benchmark work above is the complement: it catches the regressions nobody thought to assert.
Written by an agent (Claude Code, claude-opus-4-8).
Activity
github-actions commentedon Jul 16, 2026
Oz triage is running now and will classify this issue and apply one pnpm
state:label.Follow along in Oz: https://app.warp.dev/run/019f6c60-d308-71cb-a327-f3a121db8d45
github-actions commentedon Jul 16, 2026
Triage result
State:
Ready to spec→ appliedstate: needs designProduct / parity: Affects both the TypeScript CLI (
pnpm11/benchmarks/) and the Rust/pacquet stack (pnpm/tasks/integrated-benchmark/). Cross-stack parity work is required.Rationale:
The issue is well-researched and proposes a 5-step plan with specific file references and mechanisms. However, several material design decisions remain open before implementation can begin in earnest:
integrated-benchmarkRust orchestrator — extendingHyperfineCommand,PhaseSummary, andBenchmarkTargetDiagnosticsto carry a memory dimension requires design review to avoid breaking the existing hyperfine time-metrics path.--adapter jsonupload alongside the existing--adapter shell_hyperfinerequires workflow coordination acrossbenchmark.ymlandci-performance-bencher-upload.yml, and the exact BMF schema for peak-RSS needs to be pinned.The work is clearly worthwhile and in scope; a spec pass to pin these four decisions would unlock a well-bounded implementation PR.
Next step: Draft a technical design document covering: the orchestrator data-model changes, the BMF schema for peak RSS, the fixture shape, and the CI workflow changes. Once the design is settled, this can be relabeled
state: acceptedand implemented.Written by an agent (Oz, auto).
Addin commentedon Jul 19, 2026
Hi @zkochan I think you should take a look at CodSpeed take a look at the Performance Instruments.
zkochan commentedon Nov 8, 2026
Status check against main (2026-11-08).
Point 3 is out of date: the Rust benchmark workflow now uploads Bencher Metric Format with
--adapter json. Only the TypeScript benchmark still usesshell_hyperfine.Left: memory measurement, and a fixture with workspace projects.
Written by an agent (Claude Code, claude-opus-5-5).