| 51 | }; |
| 52 | |
| 53 | const print = function (results) { |
| 54 | console.log(""); |
| 55 | console.log( |
| 56 | [ |
| 57 | "|", |
| 58 | [ |
| 59 | pad(" length ", 10 + 2), |
| 60 | pad(" nanoseconds ", 15 + 2), |
| 61 | pad(" throughput ", 15 + 2), |
| 62 | ].join("|"), |
| 63 | "|", |
| 64 | ].join(""), |
| 65 | ); |
| 66 | console.log( |
| 67 | ["|", ["-".repeat(12), "-".repeat(17), "-".repeat(17)].join("|"), "|"].join( |
| 68 | "", |
| 69 | ), |
| 70 | ); |
| 71 | results.forEach(([length, nanoseconds, throughput]) => { |
| 72 | console.log( |
| 73 | [ |
| 74 | "|", |
| 75 | [ |
| 76 | ` ${pad(`${length}`, 10)} `, |
| 77 | ` ${pad(`${nanoseconds}`, 15)} `, |
| 78 | ` ${pad(`${throughput}`, 15)} `, |
| 79 | ].join("|"), |
| 80 | "|", |
| 81 | ].join(""), |
| 82 | ); |
| 83 | }); |
| 84 | console.log(""); |
| 85 | }; |
| 86 | |
| 87 | const main = async function () { |
| 88 | const tests = [20000, 200000, 2000000, 20000000, 200000000].map((length) => ({ |