/** * benchmark.ts — Benchmark suite runner for pi.dev extensions. * * Defines benchmark suites, runs them, compares results against baselines, * and produces comparison matrices. */ import { type ProfileResult } from "./profiler.js"; export interface BenchmarkCase { name: string; toolName: string; args?: Record; iterations?: number; warmup?: boolean; } export interface BenchmarkSuite { name: string; description?: string; cases: BenchmarkCase[]; } export interface BenchmarkResult { suiteName: string; cases: CaseResult[]; total_duration_ms: number; timestamp: string; } export interface CaseResult { name: string; profile: ProfileResult; status: "pass" | "fail" | "warn"; regression_pct?: number; } export interface ComparisonMatrix { current: BenchmarkResult; baseline?: BenchmarkResult; summary: { total: number; passed: number; failed: number; warned: number; regressions: string[]; improvements: string[]; }; } /** * Load a benchmark suite from a JSON file. */ export declare function loadSuite(suitePath: string): BenchmarkSuite; /** * Discover suites in the default directory. */ export declare function discoverSuites(baseDir?: string): string[]; /** * Run a full benchmark suite. */ export declare function runSuite(suite: BenchmarkSuite, executor?: (toolName: string, args?: Record) => Promise): Promise; /** * Compare current results against a baseline. * Marks regressions ( >15% slower ), improvements ( >10% faster ), * and warns on moderate slowdowns ( >5% ). */ export declare function compareResults(current: BenchmarkResult, baseline: BenchmarkResult): ComparisonMatrix; /** * Format a comparison matrix as a markdown table. */ export declare function formatComparisonMarkdown(matrix: ComparisonMatrix): string; /** * Format as plain table (for terminal). */ export declare function formatComparisonTable(matrix: ComparisonMatrix): string;