eslint-rule-benchmark
Version:
Benchmark ESLint rules with detailed performance metrics for CI and plugin development
19 lines (18 loc) • 546 B
JavaScript
import { Bench } from 'tinybench'
import {
DEFAULT_TIMEOUT_MS,
DEFAULT_ITERATIONS,
DEFAULT_WARMUP_TIME_MS,
DEFAULT_WARMUP_ITERATIONS,
} from '../../constants/index.js'
function createBench(options = {}) {
return new Bench({
warmupIterations: options.warmup
? (options.warmupIterations ?? DEFAULT_WARMUP_ITERATIONS)
: 0,
warmupTime: options.warmup ? DEFAULT_WARMUP_TIME_MS : 0,
iterations: options.iterations ?? DEFAULT_ITERATIONS,
time: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
})
}
export { createBench }