MCPcopy
hub / github.com/colinhacks/zod / metabench

Function metabench

packages/bench/metabench.ts:14–27  ·  view source on GitHub ↗
(name: string, benchmarks?: Benchmarks<D>)

Source from the content-addressed store, hash-verified

12
13type Benchmarks<T = unknown> = { [k: string]: (d: T) => any };
14export function metabench<D>(name: string, benchmarks?: Benchmarks<D>): Metabench {
15 let bench: Metabench;
16 if (BENCH === "tinybench") {
17 bench = new Tinybench(name, benchmarks || {});
18 } else if (BENCH === "benchmarkjs") {
19 bench = new BenchmarkJS(name, benchmarks || {});
20 } else if (BENCH === "mitata") {
21 bench = new Mitata(name, benchmarks || {});
22 } else {
23 throw new Error(`Unknown benchmark runner: ${BENCH}`);
24 }
25 // console.log(`running benchmark with ${BENCH}...`);
26 return bench;
27}
28
29interface BenchWithDataParams<D> {
30 name: string;

Callers 15

property-access.tsFile · 0.85
datetime-regex.tsFile · 0.85
ipv4-regex.tsFile · 0.85
error-handling.tsFile · 0.85
safeparse.tsFile · 0.85
union.tsFile · 0.85
instanceof.tsFile · 0.85
boolean.tsFile · 0.85
lazy-box.tsFile · 0.85
array.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected