bench: Capture versions

This commit is contained in:
2026-03-18 22:10:11 +01:00
parent 3e5bf462e9
commit 7c0ad28f6e
5 changed files with 285 additions and 268 deletions

View File

@@ -298,7 +298,8 @@ for run in $(seq 1 "$RUNS"); do
done
node - "$WORK_DIR" "$RUNS" "$HAS_STRFRY" "$HAS_NOSTR_RS" <<'NODE'
node - "$WORK_DIR" "$RUNS" "$HAS_STRFRY" "$HAS_NOSTR_RS" \
"$PARRHESIA_VERSION" "$STRFRY_VERSION" "$NOSTR_RS_RELAY_VERSION" "$NOSTR_BENCH_VERSION" <<'NODE'
const fs = require("node:fs");
const path = require("node:path");
@@ -306,6 +307,10 @@ const workDir = process.argv[2];
const runs = Number(process.argv[3]);
const hasStrfry = process.argv[4] === "1";
const hasNostrRs = process.argv[5] === "1";
const parrhesiaVersion = process.argv[6] || "";
const strfryVersion = process.argv[7] || "";
const nostrRsRelayVersion = process.argv[8] || "";
const nostrBenchVersion = process.argv[9] || "";
function parseLog(filePath) {
const content = fs.readFileSync(filePath, "utf8");
@@ -502,6 +507,12 @@ if (process.env.BENCH_JSON_OUT) {
};
}
const versions = { parrhesia: parrhesiaVersion };
if (hasStrfry && strfryVersion) versions.strfry = strfryVersion;
if (hasNostrRs && nostrRsRelayVersion) versions["nostr-rs-relay"] = nostrRsRelayVersion;
if (nostrBenchVersion) versions["nostr-bench"] = nostrBenchVersion;
jsonSummary.versions = versions;
fs.writeFileSync(
process.env.BENCH_JSON_OUT,
JSON.stringify(jsonSummary, null, 2) + "\n",

View File

@@ -70,7 +70,7 @@ const fs = require("node:fs");
const [, , jsonOut, timestamp, machineId, gitTag, gitCommit, runsStr, historyFile] = process.argv;
const servers = JSON.parse(fs.readFileSync(jsonOut, "utf8"));
const { versions, ...servers } = JSON.parse(fs.readFileSync(jsonOut, "utf8"));
const entry = {
timestamp,
@@ -78,6 +78,7 @@ const entry = {
git_tag: gitTag,
git_commit: gitCommit,
runs: Number(runsStr),
versions: versions || {},
servers,
};
@@ -127,19 +128,6 @@ const presentBaselines = baselineServerNames.filter(srv =>
deduped.some(e => e.servers[srv])
);
// Compute averages for baseline servers (constant horizontal lines)
const baselineAvg = {};
for (const srv of presentBaselines) {
const vals = deduped.filter(e => e.servers[srv]).map(e => e.servers[srv]);
baselineAvg[srv] = {};
for (const metric of Object.keys(vals[0])) {
const valid = vals.map(v => v[metric]).filter(Number.isFinite);
baselineAvg[srv][metric] = valid.length > 0
? valid.reduce((a, b) => a + b, 0) / valid.length
: NaN;
}
}
// Metrics to chart
const chartMetrics = [
{ key: "event_tps", label: "Event Throughput (TPS) — higher is better", file: "event_tps.tsv", ylabel: "TPS" },
@@ -161,7 +149,7 @@ for (const cm of chartMetrics) {
e.servers["parrhesia-memory"]?.[cm.key] ?? "NaN",
];
for (const srv of presentBaselines) {
row.push(baselineAvg[srv]?.[cm.key] ?? "NaN");
row.push(e.servers[srv]?.[cm.key] ?? "NaN");
}
rows.push(row.join("\t"));
}
@@ -171,7 +159,7 @@ for (const cm of chartMetrics) {
// Generate gnuplot plot commands (handles variable column counts)
const serverLabels = ["parrhesia-pg", "parrhesia-memory"];
for (const srv of presentBaselines) serverLabels.push(srv + " (avg)");
for (const srv of presentBaselines) serverLabels.push(srv);
const plotLines = [];
for (const cm of chartMetrics) {
@@ -219,7 +207,7 @@ const fs = require("node:fs");
const [, , jsonOut, readmePath] = process.argv;
const servers = JSON.parse(fs.readFileSync(jsonOut, "utf8"));
const { versions, ...servers } = JSON.parse(fs.readFileSync(jsonOut, "utf8"));
const readme = fs.readFileSync(readmePath, "utf8");
const pg = servers["parrhesia-pg"];