import type { BenchmarkResult, BenchmarkGroup } from './benchmark_types.js'; /** * Format results as an ASCII table with percentiles, min/max, and relative performance. * All times use the same unit for easy comparison. * @param baseline - optional task name to use as baseline for comparison (defaults to fastest) * @throws Error if `baseline` is provided but no result has that name * * @example * ```ts * console.log(benchmark_format_table(results)); * // ┌─────────────┬────────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┐ * // │ Task Name │ ops/sec │ p50 (μs) │ p75 (μs) │ p90 (μs) │ p95 (μs) │ p99 (μs) │ min (μs) │ max (μs) │ vs Best │ * // ├─────────────┼────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤ * // │ slugify v2 │ 1,237,144 │ 0.81 │ 0.85 │ 0.89 │ 0.95 │ 1.20 │ 0.72 │ 2.45 │ baseline │ * // │ slugify │ 261,619 │ 3.82 │ 3.95 │ 4.12 │ 4.35 │ 5.10 │ 3.21 │ 12.45 │ 4.73x │ * // └─────────────┴────────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┘ * ``` */ export declare const benchmark_format_table: (results: Array, baseline?: string) => string; /** * Format results as a Markdown table with key metrics. * All times use the same unit for easy comparison. * @param baseline - optional task name to use as baseline for comparison (defaults to fastest) * @throws Error if `baseline` is provided but no result has that name * * @example * ```ts * console.log(benchmark_format_markdown(results)); * // | Task Name | ops/sec | p50 (μs) | p75 (μs) | p90 (μs) | p95 (μs) | p99 (μs) | min (μs) | max (μs) | vs Best | * // |------------|------------|----------|----------|----------|----------|----------|----------|----------|----------| * // | slugify v2 | 1,237,144 | 0.81 | 0.85 | 0.89 | 0.95 | 1.20 | 0.72 | 2.45 | baseline | * // | slugify | 261,619 | 3.82 | 3.95 | 4.12 | 4.35 | 5.10 | 3.21 | 12.45 | 4.73x | * ``` */ export declare const benchmark_format_markdown: (results: Array, baseline?: string) => string; /** * Format results as grouped Markdown tables with headers between groups. * * @example * ```ts * const groups = [ * { name: 'Fast Paths', filter: (r) => r.name.includes('fast'), baseline: 'fast/reference' }, * { name: 'Slow Paths', filter: (r) => r.name.includes('slow') }, * ]; * console.log(benchmark_format_markdown_grouped(results, groups)); * // ### Fast Paths * // | Task Name | ops/sec | ... | vs fast/reference | * // |-----------|---------|-----|-------------------| * // | ... | ... | ... | ... | * // * // ### Slow Paths * // | Task Name | ops/sec | ... | vs Best | * // |-----------|---------|-----|---------| * // | ... | ... | ... | ... | * ``` */ export declare const benchmark_format_markdown_grouped: (results: Array, groups: Array) => string; export interface BenchmarkFormatJsonOptions { /** Whether to pretty-print (default: true) */ pretty?: boolean; /** Whether to include raw timings array (default: false, can be large) */ include_timings?: boolean; } /** * Format results as JSON. * * @example * ```ts * console.log(format_json(results)); * console.log(format_json(results, {pretty: false})); * console.log(format_json(results, {include_timings: true})); * ``` */ export declare const benchmark_format_json: (results: Array, options?: BenchmarkFormatJsonOptions) => string; /** * Format results as a grouped table with visual separators between groups. * * @example * ```ts * const groups = [ * { name: 'FAST PATHS', filter: (r) => r.name.includes('fast') }, * { name: 'SLOW PATHS', filter: (r) => r.name.includes('slow') }, * ]; * console.log(benchmark_format_table_grouped(results, groups)); * // 📦 FAST PATHS * // ┌────┬─────────────┬────────────┬...┐ * // │ 🐆 │ fast test 1 │ 1,237,144 │...│ * // │ 🐇 │ fast test 2 │ 261,619 │...│ * // └────┴─────────────┴────────────┴...┘ * // * // 📦 SLOW PATHS * // ┌────┬─────────────┬────────────┬...┐ * // │ 🐢 │ slow test 1 │ 10,123 │...│ * // └────┴─────────────┴────────────┴...┘ * ``` */ export declare const benchmark_format_table_grouped: (results: Array, groups: Array) => string; /** * Format a number with fixed decimal places and thousands separators. * @see `format_number` in `maths.ts` for the underlying implementation. */ export declare const benchmark_format_number: (n: number, decimals?: number) => string; //# sourceMappingURL=benchmark_format.d.ts.map