@codspeed/* package wraps a benchmarking library. This page lists the
options that CodSpeed adds. For the options of the libraries themselves, see
their documentation.
Vitest
codspeedPlugin takes the options of
@codspeed/vitest-plugin. Configure the benchmarks
with the Vitest benchmarking options.
Number of forks per walltime benchmark. Requires Vitest
5.
vitest.config.ts
forks to the options of a single benchmark and to the
options of bench.compare, which apply to every benchmark of the comparison:
src/fibo.bench.ts
forks option of a benchmark takes precedence over the one of
bench.compare, which takes precedence over the plugin option.
tinybench
withCodSpeed takes the options of
@codspeed/tinybench-plugin as its second
argument. Configure the Bench itself and its tasks with the
tinybench options.
Number of forks per walltime benchmark.
benches/bench.ts
benchmark.js
@codspeed/benchmark.js-plugin adds no
options. Configure the suite and its benchmarks with the
benchmark.js options. The integration measures
all benchmarks in a single process and doesn’t support
process isolation.
Playwright
The options of@codspeed/playwright-plugin
are listed in its API section. The flow
itself uses the Playwright API.
The integration doesn’t support process isolation.
Environment variables
Environment variables take precedence over the options set in code, e.g., to change the number of forks in CI without changing code. Set them in theenv of
the step that runs your benchmarks.
Number of forks per walltime benchmark, for tinybench
and Vitest. Overrides the
forks options. Must be a positive integer.Set to
false or 0 to measure all benchmarks in a single process. The
forks options and CODSPEED_WALLTIME_FORKS are then ignored. Other values
than true, 1, false, and 0 fail the run.Number of measurement rounds of each Playwright benchmark. Overrides the
rounds option. Must be a positive integer.Process isolation
With the walltime instrument, the tinybench and Vitest integrations measure every benchmark in several fresh Node.js processes, called forks, and combine their rounds into a single result. To learn why this makes a difference, see Process Isolation. Forks run one after the other, and each fork runs the full measurement budget set bytime and iterations. With the default of 3 forks, a walltime run
takes about 3 times longer than a run in a single process. Process isolation is
on by default, does not apply to the other instruments, and requires
@codspeed/* packages >=7.0.0-beta.0.
With Vitest, process isolation requires Vitest 5. With Vitest 3 and 4, all
benchmarks run in a single process and the
forks options are ignored.