W WRNexusJS
Tooling · Package reference

@wrnexus/benchmark

Framework benchmark scenarios and repeatable performance measurements.

v0.8.7Private registryTooling

Install the package

After WorkRoot approves private registry access, install the release-aligned package:

bun add @wrnexus/benchmark@0.8.7

Request preview access. Never put registry tokens in source control.

Deterministic benchmark execution, percentiles, baseline comparisons, and regression budgets for builds, SSR, hydration, stores, and application hot paths.

import { runBenchmark, assertBenchmarkBudget } from "@wrnexus/benchmark";
const result = await runBenchmark("render", render, { iterations: 100 });
assertBenchmarkBudget(result, baseline, { p95Percent: 5 });

Complete TypeScript API

Generated from the exact installed package declarations.

interface BenchmarkOptions {
    iterations?: number;
    warmup?: number;
    clock?: () => number;
    setup?: () => void | Promise<void>;
    teardown?: () => void | Promise<void>;
}
interface BenchmarkResult {
    name: string;
    iterations: number;
    totalMs: number;
    meanMs: number;
    minMs: number;
    maxMs: number;
    p50Ms: number;
    p95Ms: number;
    p99Ms: number;
    operationsPerSecond: number;
    samples: number[];
}
interface RegressionBudget {
    meanPercent?: number;
    p95Percent?: number;
    maxAbsoluteMs?: number;
    minOperationsPerSecond?: number;
}
interface RegressionViolation {
    metric: "meanMs" | "p95Ms" | "maxMs" | "operationsPerSecond";
    baseline?: number;
    current: number;
    limit: number;
    message: string;
}
declare function percentile(values: readonly number[], quantile: number): number;
declare function runBenchmark(name: string, operation: () => void | Promise<void>, options?: BenchmarkOptions): Promise<BenchmarkResult>;
declare function compareBenchmark(current: BenchmarkResult, baseline: BenchmarkResult | undefined, budget?: RegressionBudget): RegressionViolation[];
declare function assertBenchmarkBudget(current: BenchmarkResult, baseline: BenchmarkResult | undefined, budget: RegressionBudget): void;

export { type BenchmarkOptions, type BenchmarkResult, type RegressionBudget, type RegressionViolation, assertBenchmarkBudget, compareBenchmark, percentile, runBenchmark };

Examples

Copy-ready examples from the installed package documentation.

Deterministic benchmark execution, percentiles, baseline comparisons, and regression budgets for builds, SSR, hydration, stores, and application hot paths.

import { runBenchmark, assertBenchmarkBudget } from "@wrnexus/benchmark";
const result = await runBenchmark("render", render, { iterations: 100 });
assertBenchmarkBudget(result, baseline, { p95Percent: 5 });

Install @wrnexus/benchmark

bun add @wrnexus/benchmark