MCPcopy Create free account
hub / github.com/avoidwork/filesize.js / printResults

Function printResults

benchmarks/partial-benchmark.js:54–96  ·  view source on GitHub ↗

* Prints benchmark results with comparison analysis * @param {Array} results - Array of benchmark results

(results)

Source from the content-addressed store, hash-verified

52 * @param {Array} results - Array of benchmark results
53 */
54function printResults(results) {
55 console.log("\n📊 Partial Function Benchmark Results");
56 console.log("=".repeat(85));
57 console.log(
58 "Test Name".padEnd(30) +
59 "Ops/sec".padEnd(15) +
60 "Avg (ms)".padEnd(12) +
61 "vs Direct".padEnd(12) +
62 "Notes",
63 );
64 console.log("-".repeat(85));
65
66 // Find direct call baseline for comparison
67 const directBaseline = results.find((r) => r.testName.includes("Direct call"));
68
69 results.forEach((result) => {
70 let comparison = "";
71 let note = "";
72
73 if (directBaseline && result !== directBaseline) {
74 const ratio = directBaseline.opsPerSecond / result.opsPerSecond;
75 if (ratio > 1) {
76 comparison = `${ratio.toFixed(2)}x slower`;
77 note = ratio > 2 ? "⚠️ Significant overhead" : "✓ Acceptable overhead";
78 } else {
79 comparison = `${(1 / ratio).toFixed(2)}x faster`;
80 note = "🚀 Faster than direct";
81 }
82 } else if (result === directBaseline) {
83 comparison = "baseline";
84 note = "📊 Reference";
85 }
86
87 console.log(
88 result.testName.padEnd(30) +
89 result.opsPerSecond.toLocaleString().padEnd(15) +
90 result.avgTime.padEnd(12) +
91 comparison.padEnd(12) +
92 note,
93 );
94 });
95 console.log("=".repeat(85));
96}
97
98console.log("🚀 Starting Partial Function Benchmarks...\n");
99

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected