Benchmarks: lean list queries

listBenchmarks() selected every column of every run, including the raw A/B
series, all quality eval items, hardware facts and descriptions, while lists
show only the snapshot, settings, headline numbers and the quality score. With
200 runs /api/benchmarks returned 732 KB, re-fetched every 3 s while a run was
active; the table used about 55 KB of it.

- listBenchmarks() returns lean rows: the headline numbers are computed on the
  server from the summary, the quality score comes from json_extract().
- The model page asks for 5 runs (it shows 5), the ⌘K index for 300.
- getBenchmark()/getBenchmarks() keep the full rows for detail and compare;
  cancel and delete only read the state.
- ListRow (lists) and RunRow (detail) are separate types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EooZ9biu7kFNB4eDJrwQc5
This commit is contained in:
Claude committed 2026-11-01 20:52:12 +00:00
1 parent 7239ba2692
commit 2e56351e96
10 files changed
+111 -34

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@ import { abCaveats, abHeadline, abMethod, abSummaryText, halfWidth } from "@/lib
import { CONFIG_ROWS, targetName } from "@/lib/benchmark-view";
import type { PairedResult } from "@/lib/db/schema";
import { cn } from "@/lib/utils";
import type { ListRow } from "../benchmark-list";
import type { RunRow } from "../benchmark-list";
const sign = (v: number) => `${v > 0 ? "+" : ""}${v.toFixed(2)}%`;
@@ -56,7 +56,7 @@ function Side({ label, name, value, unit }: { label: string; name: string; value
);
}
export function AbReport({ run }: { run: ListRow }) {
export function AbReport({ run }: { run: RunRow }) {
const ab = run.ab;
const a = run.snapshot;
const b = run.snapshotB;
@@ -39,7 +39,7 @@ import {
modelName,
targetName,
} from "@/lib/benchmark-view";
import type { ListRow } from "../benchmark-list";
import type { RunRow } from "../benchmark-list";
import { PageHero } from "@/components/hero/page-hero";
import { RunMetaCard } from "@/components/run-meta";
import {
@@ -68,7 +68,7 @@ function duration(a: string | null, b: string | null, now: number) {
: `${Math.round(s)} s`;
}
export function BenchmarkDetail({ initial }: { initial: ListRow }) {
export function BenchmarkDetail({ initial }: { initial: RunRow }) {
const router = useRouter();
const [r, setR] = useState(initial);
const [now, setNow] = useState(() => Date.now());
@@ -7,7 +7,7 @@ import { f0, f1, isBatched, reportCaveats, reportMethod, reportSubtitle, reportS
import { configChips, engineName, modelName } from "@/lib/benchmark-view";
import type { BenchmarkSummary } from "@/lib/db/schema";
import { cn } from "@/lib/utils";
import type { ListRow } from "../benchmark-list";
import type { RunRow } from "../benchmark-list";
function Tile({ label, value, unit, note }: { label: string; value: string; unit: string; note: string }) {
return (
@@ -54,7 +54,7 @@ const date = (iso: string | null | undefined) =>
: "";
/** The run's report, after launch80's bench.betterbench.v1 page; every figure is one BetterBench reported. */
export function BenchmarkReport({ run }: { run: ListRow }) {
export function BenchmarkReport({ run }: { run: RunRow }) {
const sum = run.summary;
if (!sum) return null;
const s = run.snapshot;