Skip to content
masterclass Buddy

Vitest · Command

vitest bench

Vitest benchmarks measure code inside benchmark files. Use bench() for one case, bench.compare() for comparisons, and vitest bench to run only benchmarks.

Last updated

Syntax

test(name, async ({ bench }) => { await bench(name, fn).run() })
bench.compare(bench(name, fn), ..., options)
vitest bench

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • bench
  • bench.compare()
  • bench.from()
  • benchmark.enabled
  • benchmark.include
  • benchmark.provider
  • vitest bench

Source: Benchmarking | Guide | Vitest. Checked 2026-11-03.