- A/B with betterbench ab between two deployments of the same model, with verdict, confidence interval and caveats. - Sweeps vary one or two deployment settings, deploy, benchmark and remove each variant, and compare them in one table. - Every run records CPU, RAM, VRAM, GPU utilization and power. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
889 B
TypeScript
25 lines
889 B
TypeScript
// Where benchmark files live. Shared by the worker (writes) and the web app (serves reports).
|
|
|
|
import { dirname, join, resolve } from "node:path";
|
|
import { coreEnv } from "@/lib/env";
|
|
|
|
/** BENCHMARKS_DIR, or "benchmarks" next to the SQLite file (e.g. /data/benchmarks). */
|
|
export function benchmarksDir(): string {
|
|
const env = coreEnv();
|
|
if (env.BENCHMARKS_DIR) return resolve(env.BENCHMARKS_DIR);
|
|
const db = env.DATABASE_URL.replace(/^file:/, "");
|
|
return resolve(dirname(db), "benchmarks");
|
|
}
|
|
|
|
/** Run ids are ULIDs; anything else never becomes a path. */
|
|
const RUN_ID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
|
|
export function runDir(runId: string): string {
|
|
if (!RUN_ID_RE.test(runId)) throw new Error("invalid run id");
|
|
return join(benchmarksDir(), runId);
|
|
}
|
|
|
|
export const RESULTS_FILE = "results.json";
|
|
export const REPORT_FILE = "results.html";
|
|
export const AB_FILE = "ab.json";
|