MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / printTerminalTable

Function printTerminalTable

packages/bench/src/report.ts:230–282  ·  view source on GitHub ↗
(results: readonly BenchResult[])

Source from the content-addressed store, hash-verified

228}
229
230export function printTerminalTable(results: readonly BenchResult[]): void {
231 const groups = aggregateResultsByScenario(results);
232
233 for (const [group, items] of groups) {
234 console.log(`\n ${group}`);
235 console.log(` ${"─".repeat(132)}`);
236 const header = [
237 pad("Framework", 16),
238 pad("Runs", 7, "right"),
239 pad("Mean", 12, "right"),
240 pad("Run CV", 10, "right"),
241 pad("Mean CI95", 18, "right"),
242 pad("ops/s", 14, "right"),
243 pad("Wall", 12, "right"),
244 pad("CPU (u+s)", 12, "right"),
245 pad("RSS", 10, "right"),
246 pad("Heap", 10, "right"),
247 pad("Bytes(local)", 12, "right"),
248 pad("Bytes(pty)", 12, "right"),
249 ].join("");
250 console.log(` ${header}`);
251 console.log(` ${"─".repeat(132)}`);
252
253 const baseline = items.find((r) => r.framework === "rezi-native") ?? items[0];
254 const baselineMean = baseline?.metrics.timing.mean ?? 1;
255
256 for (const r of items) {
257 const m = r.metrics;
258 const speedup =
259 r.framework === baseline?.framework
260 ? ""
261 : ` (${(m.timing.mean / baselineMean).toFixed(1)}x slower)`;
262 const bytesPerFrameKb = m.bytesProduced / Math.max(1, m.framesProduced) / 1024;
263 const row = [
264 pad(FRAMEWORK_LABELS[r.framework] ?? r.framework, 16),
265 pad(String(r.runs.length), 7, "right"),
266 pad(fmtMs(m.timing.mean), 12, "right"),
267 pad(`${(r.replicateStats.cv * 100).toFixed(1)}%`, 10, "right"),
268 pad(fmtCi95(m.timing.meanCi95Low, m.timing.meanCi95High), 18, "right"),
269 pad(fmtOps(m.opsPerSec), 14, "right"),
270 pad(fmtMs(m.totalWallMs), 12, "right"),
271 pad(fmtMs(m.cpu.userMs + m.cpu.systemMs), 12, "right"),
272 pad(fmtKb(m.memPeak.rssKb), 10, "right"),
273 pad(fmtKbOpt(m.memPeak.heapUsedKb), 10, "right"),
274 pad(fmtKb(bytesPerFrameKb), 12, "right"),
275 pad(m.ptyBytesObserved === null ? "n/a" : fmtKb(m.ptyBytesObserved / 1024), 12, "right"),
276 ].join("");
277
278 console.log(` ${row}${speedup}`);
279 }
280 }
281 console.log();
282}
283
284// ── Markdown Table ──────────────────────────────────────────────────
285

Callers 1

mainFunction · 0.85

Calls 7

padFunction · 0.85
fmtMsFunction · 0.85
fmtCi95Function · 0.85
fmtOpsFunction · 0.85
fmtKbFunction · 0.85
fmtKbOptFunction · 0.85

Tested by

no test coverage detected