/** * Decibel Benchmark Library * * First-class benchmarking for the decibel toolchain. * Supports micro (ns, pure functions) and integration (ms, I/O) benchmarks. * Includes baseline persistence and regression detection for CI. * * Usage: * - Direct: runBenchmarkSuite(benchmarks, options) * - Dojo: dojo_bench tool (discovers from experiments) * - CLI: decibel bench */ export type BenchKind = 'micro' | 'integration'; export type Verdict = 'FAST' | 'OK' | 'SLOW'; export type Stability = 'high' | 'medium' | 'low'; export interface Bench { id: string; kind?: BenchKind; threshold_p99_ns?: number; setup?: () => unknown | Promise; run: (ctx?: unknown) => void | Promise; teardown?: (ctx?: unknown) => void | Promise; } export interface BenchmarkOptions { kind: BenchKind; iterations?: number; warmup?: number; threshold_p99_ns?: number; time_budget_ms?: number; min_iterations?: number; save_baseline?: boolean; baseline_path?: string; regression_tolerance?: number; } export interface BenchmarkResult { id: string; kind: BenchKind; p50_ns: number; p95_ns: number; p99_ns: number; max_ns: number; min_ns: number; mean_ns: number; stddev_ns: number; iterations: number; stability: Stability; threshold_p99_ns: number; passed: boolean; } export interface RegressionInfo { id: string; baseline_p99_ns: number; current_p99_ns: number; delta_pct: number; regressed: boolean; tolerance_pct: number; } export interface PlatformFingerprint { git_sha?: string; git_branch?: string; node_version: string; os_arch: string; cpu_model: string; timestamp: string; } export interface BenchmarkReport { suite_id: string; kind: BenchKind; results: BenchmarkResult[]; regressions: RegressionInfo[]; verdict: Verdict; platform: PlatformFingerprint; baseline_used?: string; has_regressions: boolean; timestamp: string; } export interface Baseline { suite_id: string; platform: PlatformFingerprint; results: Record; created_at: string; } export declare function getPlatformFingerprint(): PlatformFingerprint; /** * Run a single benchmark */ export declare function runBenchmark(bench: Bench, options: BenchmarkOptions): Promise; /** * Run a suite of benchmarks */ export declare function runBenchmarkSuite(suiteId: string, benchmarks: Bench[], options?: Partial): Promise; export declare function getVerdict(results: BenchmarkResult[], hasRegressions: boolean): Verdict; export declare function formatTable(report: BenchmarkReport): string; export declare function formatMarkdown(report: BenchmarkReport): string; export interface BenchmarkOperations { [name: string]: () => void | Promise; } /** * Convert simple operations dict to Bench array */ export declare function operationsToBenches(operations: BenchmarkOperations, kind?: BenchKind): Bench[]; /** * Simple runner for operations dict (backwards compatible) */ export declare function runAllBenchmarks(suiteId: string, operations: BenchmarkOperations, options?: Partial): Promise; //# sourceMappingURL=benchmark.d.ts.map