igneum/bench/proof-systems/table.mjs

13 lines
1.5 KiB
JavaScript

// Renders every row in rows/ into one markdown table (the latest row per candidate and machine first).
import { readdirSync, readFileSync } from 'node:fs';
const dir = new URL('./rows/', import.meta.url).pathname;
const rows = readdirSync(dir).filter(f => f.endsWith('.json')).map(f => ({ file: f, ...JSON.parse(readFileSync(dir + f, 'utf8')) })).sort((a, b) => (b.date || '').localeCompare(a.date || ''));
const latest = new Map();
for (const r of rows) { const k = `${r.candidate}@${r.machine}@${r.backend}@${r.label || ''}@${r.fixture || ''}`; if (!latest.has(k)) latest.set(k, r); }
const fmt = (v, d = 1) => v === null || v === undefined ? 'n/a' : typeof v === 'number' ? v.toFixed(d) : String(v);
console.log('| Candidate | Machine, backend, note | Fixture | Cycles | Prove s | Wall s | Peak memory MiB | Proof bytes | Verify s (one core) | Recursion | Audit | Verified | Date |');
console.log('|---|---|---|---|---|---|---|---|---|---|---|---|---|');
for (const r of latest.values()) {
if (r.na) { console.log(`| ${r.candidate} | ${r.machine}, ${r.backend || 'n/a'} | n/a: ${r.na} | | | | | | | | | | ${r.date} |`); continue; }
console.log(`| ${r.candidate} | ${r.machine}, ${r.backend}${r.label ? ', ' + r.label : ''} | ${r.fixture} shard ${r.shard} | ${fmt(r.cycles, 0)} | ${fmt(r.prove_s)} | ${fmt(r.wall_s)} | ${fmt(r.peak_memory_mib, 0)} | ${fmt(r.proof_bytes, 0)} | ${fmt(r.verify_s, 3)} | ${r.recursion ? 'yes' : 'no'} | ${r.audit ? 'yes' : 'no'} | ${r.verified ? 'yes' : 'NO'} | ${r.date} |`);
}