sim-dashboard: a local, dependency-free HTML page with the simulator graphs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 23:02:35 +01:00
co-authored by Claude Sonnet 5.5
parent 60a2df3f22
commit 210ba1b3e9
4 changed files with 406 additions and 2 deletions
+3
View File
@@ -177,6 +177,9 @@ These come from the owner and are not negotiable.
- **Edit files with the Edit tool** (or Write for new files). Do not use - **Edit files with the Edit tool** (or Write for new files). Do not use
Python, `sed -i` or similar scripts to modify files. Python, `sed -i` or similar scripts to modify files.
- **Scratch files go in `.tmp/` in the project**, not `/tmp`. - **Scratch files go in `.tmp/` in the project**, not `/tmp`.
- **Run `scripts/sim-sweep.sh` only when the owner says so**, and render
graphs and dashboards locally (`scripts/sim-dashboard.mjs`); never publish
them to claude.ai.
- **Ask design decisions with the question tool**, but not routinely: pick the - **Ask design decisions with the question tool**, but not routinely: pick the
conventional default for small things and say so. conventional default for small things and say so.
- **Commit and push finished work to `main`** (allow rules for `git commit` and - **Commit and push finished work to `main`** (allow rules for `git commit` and
+5 -2
View File
@@ -623,8 +623,11 @@ packet loss looks like above TCP), `-hostile` (an attacker with no validators),
**How large a network can it carry?** `scripts/sim-sweep.sh` runs growing **How large a network can it carry?** `scripts/sim-sweep.sh` runs growing
networks (8 regions, 3 seeds, 30 listings, 20 messages, 3 reports, 10% churn) networks (8 regions, 3 seeds, 30 listings, 20 messages, 3 reports, 10% churn)
and records each as JSON in `.tmp/sim/`; `scripts/sim-report.mjs` turns them and records each as JSON in `.tmp/sim/` (run it only when you mean to: it takes
into the tables behind the graphs. Result on a 16 GB, 8-core machine: many minutes and several GB of memory). `node scripts/sim-report.mjs` turns the
runs into tables and `node scripts/sim-dashboard.mjs` builds
`.tmp/sim/dashboard.html`, a self-contained page with the graphs; nothing is
uploaded anywhere. Result on a 16 GB, 8-core machine:
| Nodes | As shipped (`--public` accepts 1000) | libp2p's own default limit (before the fix) | | Nodes | As shipped (`--public` accepts 1000) | libp2p's own default limit (before the fix) |
|---|---|---| |---|---|---|
+26
View File
@@ -0,0 +1,26 @@
// Builds one self-contained HTML page with the graphs of the simulator runs.
// Nothing is uploaded anywhere; open the file in a browser.
//
// node scripts/sim-report.mjs # turn the runs in .tmp/sim into tables
// node scripts/sim-dashboard.mjs # -> .tmp/sim/dashboard.html
import { readFileSync, writeFileSync } from "node:fs";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const here = dirname(fileURLToPath(import.meta.url));
const dir = resolve(process.argv[2] ?? join(here, "..", ".tmp", "sim"));
const read = (name) => JSON.parse(readFileSync(join(dir, "data", `${name}.json`), "utf8"));
const data = {
scaling: read("scaling"),
timeline: read("timeline"),
phases: read("phases"),
arrival: read("arrival"),
generated: new Date().toISOString().slice(0, 16).replace("T", " "),
};
// "<" cannot appear in the JSON, so the data can never close its own script tag
const json = JSON.stringify(data).replace(/</g, "\\u003c");
const page = readFileSync(join(here, "sim-dashboard.template.html"), "utf8").replace("__DATA__", () => json);
const out = join(dir, "dashboard.html");
writeFileSync(out, page);
console.log(`wrote ${out} (${Math.round(page.length / 1024)} KB, ${data.scaling.length} runs)`);
+372
View File
@@ -0,0 +1,372 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Allmende network tests</title>
<style>
/* Palette: the first four slots of a validated categorical palette, light and dark. */
:root {
color-scheme: light;
--bg: #f7f7f5; --panel: #fcfcfb; --fg: #0b0b0b; --fg2: #52514e; --line: #dcdbd6;
--grid: #e7e6e1; --axis: #9b9a93; --band: #ecebe6; --pop: #ffffff; --shadow: 0 4px 14px rgba(0,0,0,.12);
--s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
--font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
color-scheme: dark;
--bg: #121211; --panel: #1a1a19; --fg: #f0efec; --fg2: #c3c2b7; --line: #353532;
--grid: #2b2b29; --axis: #6f6e68; --band: #232321; --pop: #242422; --shadow: 0 4px 14px rgba(0,0,0,.5);
--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
}
}
:root[data-theme="dark"] {
color-scheme: dark;
--bg: #121211; --panel: #1a1a19; --fg: #f0efec; --fg2: #c3c2b7; --line: #353532;
--grid: #2b2b29; --axis: #6f6e68; --band: #232321; --pop: #242422; --shadow: 0 4px 14px rgba(0,0,0,.5);
--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); }
main { max-width: 1080px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-left, 0px)) 48px max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 24px; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 600; margin: 0 0 10px; text-wrap: balance; }
h2 { font-size: 18px; margin: 0; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 4px; font-weight: 600; }
p { margin: 0; max-width: 72ch; }
.lede { font-size: 17px; line-height: 1.5; }
.lede b { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg2); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 20px; }
.grid > div { min-width: 0; }
.chart { position: relative; min-height: 230px; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--fg2); margin-bottom: 4px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--pop); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 6px; padding: 6px 8px; font-size: 12px; color: var(--fg2); white-space: nowrap; z-index: 2; font-variant-numeric: tabular-nums; }
.tip b { color: var(--fg); }
svg text { fill: var(--fg2); font-size: 12px; font-family: var(--font); }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
select { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--fg2); font-weight: 600; }
details { color: var(--fg2); }
summary { cursor: pointer; color: var(--fg); }
details p { margin-top: 8px; }
footer { font-size: 12px; color: var(--fg2); }
code { font-size: 12px; }
</style>
</head>
<body>
<main>
<header>
<h1>Allmende network tests</h1>
<p class="lede" id="takeaway"></p>
</header>
<section class="card">
<div>
<h2>How many nodes can the network carry?</h2>
<p class="muted">Each point is one run of real nodes in one process. The two lines differ in one thing: how many inbound connections the three seed nodes accept. A hollow point means the mesh never formed completely within the wait.</p>
</div>
<div class="grid">
<div><h3>Listings that arrived, in %</h3><div class="chart" id="c-deliv"></div></div>
<div><h3>Time until every node knew regional peers, in seconds</h3><div class="chart" id="c-mesh"></div></div>
<div><h3>A listing reaches 95% of its nodes within, in ms</h3><div class="chart" id="c-p95"></div></div>
<div><h3>Nodes that never found a single peer</h3><div class="chart" id="c-alone"></div></div>
</div>
</section>
<section class="card">
<div>
<h2>What it costs</h2>
<p class="muted">Totals for all nodes together, since they share one process. Real nodes each pay only their own share.</p>
</div>
<div class="grid">
<div><h3>Peak memory (heap), in MB</h3><div class="chart" id="c-heap"></div></div>
<div><h3>CPU time used by the run, in seconds</h3><div class="chart" id="c-cpu"></div></div>
<div><h3>Peak goroutines</h3><div class="chart" id="c-gor"></div></div>
<div><h3>Traffic sent per node, in KB</h3><div class="chart" id="c-traffic"></div></div>
</div>
</section>
<section class="card">
<div class="row">
<div>
<h2>One run over time</h2>
<p class="muted">Shaded bands alternate between the phases of the run: start, mesh formation, listings, messages, reports, then nodes leaving and coming back.</p>
</div>
<select id="run-select" aria-label="Run"></select>
</div>
<div id="timeline"></div>
</section>
<section class="card">
<div>
<h2>How fast a listing arrives</h2>
<p class="muted">The share of all expected deliveries that had happened after a given time. A line that stops below 100% shows nodes the listing never reached.</p>
</div>
<div class="chart" id="c-cdf"></div>
</section>
<section class="card">
<h2>All runs</h2>
<div class="wrap"><table>
<thead><tr id="runs-head"></tr></thead>
<tbody id="runs-body"></tbody>
</table></div>
</section>
<details>
<summary>How these tests ran</summary>
<p>Every node is the real thing: a libp2p host, gossipsub, the DHT, a store and its own identity. They run in one Go process on one machine and talk over loopback, so there is no real latency, packet loss or NAT. Three seed nodes are reachable by everyone and follow no region; every other node follows one region, a fifth of them two. Each run publishes 30 listings, sends 20 messages and 3 abuse reports, then takes a tenth of the nodes offline while more listings appear and brings them back. "Listings that arrived" counts every delivery to a node that follows the listing's region.</p>
<p>The seeds' connection limit is how many inbound connections a --public node accepts: 1000 as shipped, and libp2p's own default in the comparison runs (it scales with memory and was about 190 on a 16 GB machine, which is what stranded nodes before it was set). Run <code>scripts/sim-sweep.sh</code>, then <code>node scripts/sim-dashboard.mjs</code> to rebuild this page.</p>
</details>
<footer id="generated"></footer>
</main>
<script id="data" type="application/json">__DATA__</script>
<script>
"use strict";
const DATA = JSON.parse(document.getElementById("data").textContent);
const { scaling, timeline, phases, arrival } = DATA;
const NS = "http://www.w3.org/2000/svg";
const COLORS = ["var(--s1)", "var(--s2)", "var(--s3)", "var(--s4)"];
const int = (v) => Math.round(v).toLocaleString("en-US");
const one = (v) => (Math.round(v * 10) / 10).toLocaleString("en-US", { minimumFractionDigits: 1, maximumFractionDigits: 1 });
const nice = (run) => {
const m = /^(fixed|default)-(\d+)$/.exec(run);
return m ? `${m[2]} nodes, ${m[1] === "fixed" ? "as shipped" : "libp2p's default limit"}` : run;
};
function svg(tag, attrs, parent) {
const e = document.createElementNS(NS, tag);
for (const [k, v] of Object.entries(attrs || {})) e.setAttribute(k, v);
if (parent) parent.append(e);
return e;
}
function html(tag, cls, text) {
const e = document.createElement(tag);
if (cls) e.className = cls;
if (text != null) e.textContent = text;
return e;
}
// 1, 2, 5 times a power of ten
function niceStep(range, n) {
const raw = range / n, p = Math.pow(10, Math.floor(Math.log10(raw))), f = raw / p;
return (f <= 1 ? 1 : f <= 2 ? 2 : f <= 5 ? 5 : 10) * p;
}
function axisTicks(max, n) {
const step = niceStep(max, n), top = Math.ceil(max / step - 1e-9) * step, out = [];
for (let v = 0; v <= top + 1e-9; v += step) out.push(Math.round(v * 1e9) / 1e9);
return { ticks: out, top };
}
// A line chart with a legend, hover tooltip and optional phase bands.
function lineChart(el, o) {
const series = o.series.filter((s) => s.pts.length);
el.replaceChildren();
if (!series.length) { el.textContent = "no data"; return; }
const W = Math.max(260, el.clientWidth || 520), H = o.height || 230;
const fmt = o.y.fmt || int, xfmt = o.x.fmt || int;
if (series.length > 1) {
const lg = html("div", "legend");
for (const s of series) {
const item = html("span");
const sw = html("span", "sw");
sw.style.background = s.color;
item.append(sw, s.name);
lg.append(item);
}
el.append(lg);
}
const root = svg("svg", { width: W, height: H, role: "img", "aria-label": o.label }, el);
const allX = series.flatMap((s) => s.pts.map((p) => p.x));
const allY = series.flatMap((s) => s.pts.map((p) => p.y));
const xmax = o.x.max ?? Math.max(...allX, 1);
const yt = axisTicks(o.y.max ?? Math.max(...allY, 1) * 1.05, 5);
// the left margin follows the widest tick label as drawn
let lw = 0;
const probe = svg("text", { opacity: 0 }, root);
for (const t of yt.ticks) { probe.textContent = fmt(t); lw = Math.max(lw, probe.getComputedTextLength() || 7 * fmt(t).length); }
probe.remove();
const m = { t: 10, r: 16, b: 38, l: Math.ceil(lw) + 14 };
const x = (v) => m.l + (v / xmax) * (W - m.l - m.r);
const y = (v) => H - m.b - (v / yt.top) * (H - m.b - m.t);
// phase bands, every other one shaded, labelled when wide enough
(o.bands || []).forEach((b, i) => {
if (i % 2 === 0) svg("rect", { x: x(b.from), y: m.t, width: Math.max(1, x(b.to) - x(b.from)), height: H - m.b - m.t, fill: "var(--band)" }, root);
});
(o.bands || []).forEach((b) => {
if (x(b.to) - x(b.from) > 44) svg("text", { x: x(b.from) + 4, y: m.t + 11 }, root).textContent = b.label;
});
for (const t of yt.ticks) {
svg("line", { x1: m.l, x2: W - m.r, y1: y(t), y2: y(t), stroke: "var(--grid)" }, root);
const lab = svg("text", { x: m.l - 8, y: y(t) + 4, "text-anchor": "end" }, root);
lab.textContent = fmt(t);
}
svg("line", { x1: m.l, x2: W - m.r, y1: H - m.b, y2: H - m.b, stroke: "var(--axis)" }, root);
const xt = axisTicks(xmax, Math.max(3, Math.floor(W / 90)));
for (const t of xt.ticks) {
if (t > xmax + 1e-9) continue;
svg("line", { x1: x(t), x2: x(t), y1: H - m.b, y2: H - m.b + 4, stroke: "var(--axis)" }, root);
svg("text", { x: x(t), y: H - m.b + 17, "text-anchor": "middle" }, root).textContent = xfmt(t);
}
svg("text", { x: m.l + (W - m.l - m.r) / 2, y: H - 4, "text-anchor": "middle" }, root).textContent = o.x.label;
for (const s of series) {
const d = s.pts.map((p, i) => `${i ? "L" : "M"}${x(p.x).toFixed(1)},${y(p.y).toFixed(1)}`).join("");
svg("path", { d, fill: "none", "stroke-width": 2, "stroke-linejoin": "round", style: `stroke:${s.color}` }, root);
if (o.markers !== false) {
for (const p of s.pts) {
svg("circle", { cx: x(p.x), cy: y(p.y), r: 4, "stroke-width": 2, style: `stroke:${s.color};fill:${p.hollow ? "var(--panel)" : s.color}` }, root);
}
}
}
// hover: the nearest x any series has, with every series' value there
const xs = [...new Set(allX)].sort((a, b) => a - b);
const cursor = svg("line", { y1: m.t, y2: H - m.b, stroke: "var(--axis)", visibility: "hidden" }, root);
const dots = svg("g", {}, root);
const tip = html("div", "tip");
tip.hidden = true;
el.append(tip);
const hit = svg("rect", { x: m.l, y: m.t, width: W - m.l - m.r, height: H - m.t - m.b, fill: "transparent" }, root);
hit.addEventListener("pointermove", (ev) => {
const px = ev.clientX - root.getBoundingClientRect().left;
const target = ((px - m.l) / (W - m.l - m.r)) * xmax;
const xv = xs.reduce((best, v) => (Math.abs(v - target) < Math.abs(best - target) ? v : best), xs[0]);
cursor.setAttribute("x1", x(xv)); cursor.setAttribute("x2", x(xv)); cursor.setAttribute("visibility", "visible");
dots.replaceChildren();
tip.replaceChildren(html("div", "", ""));
tip.firstChild.append(Object.assign(html("b"), { textContent: o.x.tip ? o.x.tip(xv) : xfmt(xv) }));
for (const s of series) {
const p = s.pts.find((q) => q.x === xv);
if (!p) continue;
svg("circle", { cx: x(xv), cy: y(p.y), r: 5, "stroke-width": 2, style: `stroke:var(--panel);fill:${s.color}` }, dots);
const row = html("div");
const sw = html("span", "sw");
sw.style.background = s.color;
row.append(sw, `${series.length > 1 ? s.name + ": " : ""}${fmt(p.y)}${p.note ? " (" + p.note + ")" : ""}`);
tip.append(row);
}
tip.hidden = false;
const tw = tip.offsetWidth;
tip.style.left = `${Math.max(0, x(xv) + 12 + tw > W ? x(xv) - tw - 12 : x(xv) + 12)}px`;
tip.style.top = `${root.offsetTop + m.t + 6}px`;
});
hit.addEventListener("pointerleave", () => { tip.hidden = true; cursor.setAttribute("visibility", "hidden"); dots.replaceChildren(); });
}
// ---- the headline sentence ---------------------------------------------------------------
(function headline() {
const byNodes = (a, b) => b.nodes - a.nodes;
const fixed = scaling.filter((r) => r.limit === "fixed" && r.mesh_complete).sort(byNodes)[0];
const defOk = scaling.filter((r) => r.limit === "libp2p default" && r.mesh_complete).sort(byNodes)[0];
const defBig = scaling.filter((r) => r.limit === "libp2p default").sort(byNodes)[0];
const t = document.getElementById("takeaway");
if (!fixed) { t.textContent = "No complete run yet."; return; }
const b = (v) => Object.assign(document.createElement("b"), { textContent: String(v) });
t.append("As shipped, with seeds that accept 1000 connections, a network of ", b(fixed.nodes), " nodes delivered ", b(fixed.listing_delivered_pct), "% of its listings to every node that follows their region.");
if (defOk && defBig) {
t.append(" With libp2p's default limit, the largest network that formed completely had ", b(defOk.nodes), " nodes; at ", b(defBig.nodes), " nodes only ", b(defBig.listing_delivered_pct), "% of listings arrived, because ", b(defBig.nodes_without_peers), " nodes never found a single peer.");
}
})();
// ---- charts over the number of nodes ------------------------------------------------------------
function scalingSeries(field) {
const mk = (limit, name, i) => ({
name, color: COLORS[i],
pts: scaling.filter((r) => r.limit === limit && r[field] != null).sort((a, b) => a.nodes - b.nodes)
.map((r) => ({ x: r.nodes, y: r[field], hollow: !r.mesh_complete, note: r.mesh_complete ? "" : "mesh never completed" })),
});
return [mk("fixed", "As shipped (1000 connections)", 0), mk("libp2p default", "libp2p's default limit", 1)];
}
const SCALING = [
["c-deliv", "listing_delivered_pct", "Share of listings that arrived, by network size", (v) => `${v}%`, 100],
["c-mesh", "mesh_s", "Seconds until the mesh formed, by network size", (v) => `${v} s`],
["c-p95", "listing_p95_ms", "Listing delivery time at the 95th percentile, by network size", (v) => `${int(v)} ms`],
["c-alone", "nodes_without_peers", "Nodes without any peer, by network size", int],
["c-heap", "heap_peak_mb", "Peak memory, by network size", (v) => `${int(v)} MB`],
["c-cpu", "cpu_seconds", "CPU seconds used, by network size", (v) => `${int(v)} s`],
["c-gor", "goroutines_peak", "Peak goroutines, by network size", int],
["c-traffic", "traffic_kb_per_node", "Traffic sent per node, by network size", (v) => `${int(v)} KB`],
];
// ---- one run over time ----------------------------------------------------------------------------------
const runs = [...new Set(timeline.map((r) => r.run))];
let currentRun = runs.includes("fixed-800") ? "fixed-800" : runs[runs.length - 1];
const select = document.getElementById("run-select");
select.replaceChildren(...runs.map((r) => new Option(nice(r), r)));
select.value = currentRun;
select.onchange = () => { currentRun = select.value; drawTimeline(); };
function drawTimeline() {
const el = document.getElementById("timeline");
const rows = timeline.filter((r) => r.run === currentRun);
const bands = phases.filter((r) => r.run === currentRun).map((r) => ({ from: r.from, to: r.to, label: r.name }));
el.replaceChildren();
const grid = html("div", "grid");
el.append(grid);
const charts = [
["heap_mb", "Memory (heap), in MB", (v) => `${int(v)} MB`],
["goroutines", "Goroutines", int],
["cpu_cores", "CPU cores busy", one],
["sent_mb_per_s", "Traffic sent by all nodes, in MB per second", one],
].map((spec) => {
// every box is in the grid before any chart measures its width
const box = html("div");
const c = html("div", "chart");
box.append(html("h3", "", spec[1]), c);
grid.append(box);
return [...spec, c];
});
for (const [field, title, fmt, c] of charts) {
lineChart(c, {
label: `${title} over the run`, height: 190, markers: false, bands,
series: [{ name: title, color: COLORS[0], pts: rows.map((r) => ({ x: r.t, y: r[field] })) }],
x: { label: "Seconds since the run began", tip: (v) => `${v} s` }, y: { fmt },
});
}
}
function drawCdf() {
const wanted = ["fixed-100", "fixed-300", "fixed-800", "default-400"].filter((r) => arrival.some((a) => a.run === r));
lineChart(document.getElementById("c-cdf"), {
label: "Share of deliveries done after a given time", height: 280, markers: false,
series: wanted.map((run, i) => ({ name: nice(run), color: COLORS[i], pts: [{ x: 0, y: 0 }, ...arrival.filter((r) => r.run === run).map((r) => ({ x: r.ms, y: r.share }))] })),
x: { label: "Milliseconds after the listing was published", tip: (v) => `${v} ms` }, y: { fmt: (v) => `${v}%`, max: 100 },
});
}
// ---- the table ----------------------------------------------------------------------------------------------------------
const COLS = [["run", "Run"], ["nodes", "Nodes"], ["mesh_s", "Mesh (s)"], ["nodes_without_peers", "No peer"], ["listing_delivered_pct", "Listings (%)"], ["listing_p95_ms", "p95 (ms)"], ["message_p95_ms", "Message p95 (ms)"], ["report_p95_ms", "Report p95 (ms)"], ["heap_peak_mb", "Heap (MB)"], ["goroutines_peak", "Goroutines"], ["cpu_seconds", "CPU (s)"], ["traffic_kb_per_node", "KB per node"]];
document.getElementById("runs-head").replaceChildren(...COLS.map(([, h]) => html("th", "", h)));
document.getElementById("runs-body").replaceChildren(...[...scaling].sort((a, b) => a.limit.localeCompare(b.limit) || a.nodes - b.nodes).map((r) => {
const tr = html("tr");
for (const [k] of COLS) tr.append(html("td", "", r[k] == null ? "–" : String(r[k])));
return tr;
}));
document.getElementById("generated").textContent = `Generated ${DATA.generated} from ${scaling.length} runs.`;
function drawAll() {
for (const [id, field, label, fmt, ymax] of SCALING) {
lineChart(document.getElementById(id), { label, series: scalingSeries(field), x: { label: "Nodes in the network", max: Math.ceil(Math.max(...scaling.map((r) => r.nodes)) / 50) * 50 + 50, tip: (v) => `${v} nodes` }, y: { fmt, max: ymax } });
}
drawTimeline();
drawCdf();
}
drawAll();
let resizeTimer = null;
addEventListener("resize", () => { clearTimeout(resizeTimer); resizeTimer = setTimeout(drawAll, 150); });
</script>
</body>
</html>