| 764 | // ── Results writing ─────────────────────────────────────────────────────────── |
| 765 | |
| 766 | function writeResults(allResults) { |
| 767 | try { |
| 768 | if (!fs.existsSync(RESULTS_DIR)) { |
| 769 | fs.mkdirSync(RESULTS_DIR, { recursive: true }); |
| 770 | } |
| 771 | const date = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19); |
| 772 | const outFile = path.join(RESULTS_DIR, `bench-${date}.jsonl`); |
| 773 | const lines = allResults.map(r => JSON.stringify(r)); |
| 774 | fs.writeFileSync(outFile, lines.join('\n') + '\n'); |
| 775 | return outFile; |
| 776 | } catch { return null; } |
| 777 | } |
| 778 | |
| 779 | // ── Output formatting ───────────────────────────────────────────────────────── |
| 780 | |