Measured by us
${escape(name)}
- ${facts.map(([k, v]) => `
- ${k}
- ${escape(String(v))}
${escape(rows.find((r) => r.note).note)}
` : ""}| ${head} |
| ${sub} |
Where Java is ahead: ${escape(javaWins.join("; "))}.
` : `Horizon is ahead on every figure here.
`}// The Benchmarks page's tables, from the summary (public/benchmarks.json, or the telemetry server's // GET /v1/benchmarks/summary in the same shape). Shared by build.mjs (baked) and benchmarks-page.js (live). import { escape } from "./markdown.js"; export const METRICS = [ { key: "avg_fps", label: "Average FPS", kind: "fps", better: "high" }, { key: "low_1pct_fps", label: "1% low FPS", kind: "fps", better: "high", hint: "the slowest 1% of frames, as FPS" }, { key: "p95_ms", label: "Frame time, 95th percentile", kind: "ms", better: "low" }, { key: "world_ms", label: "Start to in-world", kind: "ms", better: "low", hint: "process start to the spawn area loaded and drawn" }, { key: "chunk_load_ms", label: "Chunk load after a teleport", kind: "ms", better: "low", hint: "the four scenes' average" }, { key: "rss_steady_mb", label: "Memory while playing", kind: "mb", better: "low" }, { key: "rss_peak_mb", label: "Memory, peak", kind: "mb", better: "low" }, ]; export function format(kind, x) { if (x == null || !Number.isFinite(x)) return "–"; if (kind === "fps") return x >= 100 ? Math.round(x).toLocaleString("en") : x.toFixed(x >= 10 ? 0 : 1); if (kind === "ms") return x >= 1000 ? `${(x / 1000).toFixed(x >= 10000 ? 0 : 1)} s` : `${x < 10 ? x.toFixed(1) : Math.round(x)} ms`; if (kind === "mb") return x >= 1000 ? `${(x / 1024).toFixed(1)} GB` : `${Math.round(x)} MB`; return String(x); } // "2.4x faster", "1.3x slower", "2.0x less" (memory), from Horizon's side. export function compare(metric, horizon, java) { if (horizon == null || java == null || !horizon || !java) return null; const ratio = metric.better === "high" ? horizon / java : java / horizon; if (Math.abs(ratio - 1) < 0.05) return { text: "about the same", wins: "tie" }; const word = metric.kind === "mb" ? (ratio > 1 ? "less" : "more") : ratio > 1 ? "faster" : "slower"; const r = ratio > 1 ? ratio : 1 / ratio; return { text: `${r.toFixed(r >= 10 ? 0 : 1)}x ${word}`, wins: ratio > 1 ? "horizon" : "java" }; } // The game's average frame rate sat at a display cap (`capped_fps`): the real one is at least that. export const capped = (row) => Boolean(row?.capped_fps && row.medians?.avg_fps >= row.capped_fps * 0.97); // compare() between two rows, saying "at least" where Horizon's average sat at a cap. export function compareRows(metric, h, j) { const c = compare(metric, h?.medians?.[metric.key], j?.medians?.[metric.key]); if (!c || metric.key !== "avg_fps" || !capped(h)) return c; return c.wins === "horizon" ? { ...c, text: `at least ${c.text}` } : { text: "capped, can't tell", wins: "none" }; } export const cell = (metric, row) => { const v = format(metric.kind, row?.medians?.[metric.key]); return metric.key === "avg_fps" && capped(row) ? `${v} (cap)` : v; }; const machines = (groups) => { const by = new Map(); for (const g of groups.filter((g) => g.source === "us")) { if (!by.has(g.machine)) by.set(g.machine, []); by.get(g.machine).push(g); } return by; }; const pick = (rows, game, rd) => rows.find((r) => r.game === game && r.render_distance === rd); // One machine we measured: Horizon and Java side by side at each render distance. export function machineHtml(name, rows) { const first = rows[0]; const distances = [...new Set(rows.map((r) => r.render_distance))].sort((a, b) => a - b); const horizon = rows.find((r) => r.game === "horizon"); const java = rows.find((r) => r.game === "vanilla"); const head = distances.map((rd) => `
Measured by us
${escape(rows.find((r) => r.note).note)}
` : ""}| ${head} |
| ${sub} |
Where Java is ahead: ${escape(javaWins.join("; "))}.
` : `Horizon is ahead on every figure here.
`}No measurements are published yet.
`; return [...by].map(([name, rows]) => machineHtml(name, rows)).join("\n"); } // The hardware breakdowns (the server's classes), in words. export const DIMENSIONS = [ { key: "ram", label: "Memory", word: (c) => `${c} RAM` }, { key: "vram", label: "Graphics memory", word: (c) => (c === "shared" ? "shared graphics memory" : `${c} graphics memory`) }, { key: "storage", label: "Drive", word: (c) => ({ nvme: "NVMe", ssd: "SSD", hdd: "hard disk" })[c] || c }, { key: "os", label: "System", word: (c) => ({ linux: "Linux", macos: "macOS", windows: "Windows" })[c] || c }, { key: "gpu_kind", label: "Graphics", word: (c) => (c === "integrated" ? "integrated GPU" : c === "discrete" ? "separate GPU" : c) }, ]; // A group's breakdowns in one line: "32 GB RAM (3) · NVMe (3) · Linux (3)". Empty without any. export function breakdownLine(breakdowns) { return DIMENSIONS.flatMap((d) => (breakdowns?.[d.key] || []).map((c) => `${d.word(c.class)} (${c.installs})`)).join(" · "); } // GET /v1/aggregate's breakdowns: players' play sessions per hardware class. Empty without any. export function hardwareHtml(aggregate) { const b = aggregate?.breakdowns || {}; const dims = DIMENSIONS.filter((d) => b[d.key]?.length); if (!dims.length) return ""; const rows = dims .flatMap((d) => b[d.key].map( (c, i) => `| By | Class | Installs | Hours played | Frame time, median | Frame time, 99th percentile |
|---|
No player results yet. A GPU and CPU pair shows here once at least ${summary?.min_installs || 3} different installs have shared a benchmark with it.
`; const rows = groups .map( (g) => `| GPU and CPU | Render distance | Game | Average FPS | 1% low | p95 | To in-world | Memory | Source |
|---|