Files
zigbee2mqtt/test/benchOptions.ts
2025-08-27 20:12:30 +02:00

15 lines
448 B
TypeScript

import {hrtime} from "node:process";
import type {bench} from "vitest";
export const BENCH_OPTIONS: NonNullable<Parameters<typeof bench>[2]> = {
throws: true,
warmupTime: 1000,
now: () => Number(hrtime.bigint()) / 1e6,
setup: (_task, mode) => {
// Run the garbage collector before warmup at each cycle
if (mode === "warmup" && typeof globalThis.gc === "function") {
globalThis.gc();
}
},
};