benchmark_types.ts view source
BenchmarkConfig Configuration options for a benchmark suite.
duration_ms
Target duration to run each benchmark task in milliseconds. The benchmark will run until this duration is reached or max_iterations is hit. Default: 1000ms
numberwarmup_iterations
Number of warmup iterations before actual measurements. Warmup helps stabilize JIT compilation and caches. Default: 5
numbercooldown_ms
Cooldown time between tasks in milliseconds. Helps prevent interference between benchmarks. Default: 100ms
numbermin_iterations
Minimum number of iterations to run. Default: 10
numbermax_iterations
Maximum number of iterations to run. Prevents infinite loops if function is extremely fast. Default: 100000
numbertimer
Custom timer to use for measurements. Default: timer_default (auto-detects environment)
on_iteration
Callback invoked after each iteration completes. Useful for triggering garbage collection, logging progress, early termination, or custom instrumentation.
Note: The callback time is NOT included in iteration measurements - it runs after the timing capture. However, frequent GC calls will slow overall benchmark execution time.
(task_name: string, iteration: number, abort: () => void) => voidon_task_complete
Callback invoked after each task completes. Useful for logging progress during long benchmark runs.
(result: BenchmarkResult, index: number, total: number) => void