* Prints benchmark results in a formatted table * @param {Array} results - Array of benchmark results
(results)
| 48 | * @param {Array} results - Array of benchmark results |
| 49 | */ |
| 50 | function printResults(results) { |
| 51 | console.log("\n📊 Basic Performance Benchmark Results"); |
| 52 | console.log("=".repeat(80)); |
| 53 | console.log( |
| 54 | "Test Name".padEnd(25) + |
| 55 | "Iterations".padEnd(12) + |
| 56 | "Total (ms)".padEnd(12) + |
| 57 | "Avg (ms)".padEnd(12) + |
| 58 | "Ops/sec", |
| 59 | ); |
| 60 | console.log("-".repeat(80)); |
| 61 | |
| 62 | results.forEach((result) => { |
| 63 | console.log( |
| 64 | result.testName.padEnd(25) + |
| 65 | result.iterations.toString().padEnd(12) + |
| 66 | result.totalTime.padEnd(12) + |
| 67 | result.avgTime.padEnd(12) + |
| 68 | result.opsPerSecond.toLocaleString(), |
| 69 | ); |
| 70 | }); |
| 71 | console.log("=".repeat(80)); |
| 72 | } |
| 73 | |
| 74 | // Test data sets |
| 75 | const testSizes = [0, 512, 1024, 1048576, 1073741824, 1099511627776, Number.MAX_SAFE_INTEGER]; |