@@ -115,4 +115,26 @@ so exercise all three of these when developing or reviewing a plugin change
115115Running these locally outside the CodSpeed runner is expected to log
116116` instrument-hooks: failed to write environment.json ` and skip actual measurement
117117writes — the point is to verify the plugin's control flow and output per mode,
118- not to produce real measurements.
118+ not to produce real measurements.
119+
120+ ## Process isolation
121+
122+ In instrumentation/simulation/memory runs with active instrument hooks, every
123+ benchmark runs in its own process (` packages/core/src/isolation.ts ` ), so the
124+ allocator and JIT state of one benchmark can't change the measurement of the
125+ next. Walltime runs and runs outside CodSpeed are not affected.
126+
127+ - ` CODSPEED_PROCESS_ISOLATION ` : unset, ` 1 ` or ` true ` turns it on (default),
128+ ` 0 ` or ` false ` runs all benchmarks in one process, any other value is an error.
129+ - The parent process re-runs itself (` process.execPath ` , ` process.execArgv ` and
130+ ` process.argv.slice(1) ` , so the V8 flags survive) once per benchmark with
131+ ` CODSPEED_ISOLATED_BENCHMARK=<uri> ` . The child runs only that benchmark, whatever
132+ the user filters are, and the parent exits with the child's exit code
133+ (` 128 + N ` for signal ` N ` ).
134+ - The child prints no banner or summary lines. They come from the parent.
135+ - Vitest measures in forked workers, so the plugin records the command of the
136+ main Vitest process (` CODSPEED_ISOLATION_COMMAND ` ) and each worker runs that
137+ command, i.e. one Vitest run per benchmark.
138+ - Tests that drive a plugin in-process against a mocked core must set
139+ ` CODSPEED_PROCESS_ISOLATION=false ` , or the plugin would start the test runner
140+ again for every benchmark.
0 commit comments