(name, h)
| 8 | const makeBigArray = (length = defaultItemsSize) => Array.from({ length }).fill(1); |
| 9 | const makeReadableTime = nanoseconds => (nanoseconds / 1e6).toFixed(3).padStart(7, class="st">' '); |
| 10 | const printHistogram = (name, h) => { |
| 11 | console.log(); |
| 12 | console.log(chalk.green(name)); |
| 13 | console.log(class="st">'-'.repeat(155)); |
| 14 | process.stdout.write(`| ${chalk.cyan(class="st">'max')}: ${chalk.red(makeReadableTime(h.max))} ms |`); |
| 15 | process.stdout.write(` ${chalk.cyan(class="st">'min')}: ${chalk.red(makeReadableTime(h.min))} ms |`); |
| 16 | process.stdout.write(` ${chalk.cyan(class="st">'mean')}: ${chalk.red(makeReadableTime(h.mean))} ms |`); |
| 17 | process.stdout.write(` ${chalk.cyan(class="st">'stddev')}: ${chalk.red(makeReadableTime(h.stddev))} ms |`); |
| 18 | process.stdout.write( |
| 19 | ` ${chalk.cyan(class="st">'p90th')}: ${chalk.red(makeReadableTime(h.percentile(90)))} ms |` |
| 20 | ); |
| 21 | process.stdout.write( |
| 22 | ` ${chalk.cyan(class="st">'p95th')}: ${chalk.red(makeReadableTime(h.percentile(95)))} ms |` |
| 23 | ); |
| 24 | process.stdout.write( |
| 25 | ` ${chalk.cyan(class="st">'p99th')}: ${chalk.red(makeReadableTime(h.percentile(99)))} ms |` |
| 26 | ); |
| 27 | console.log(class="st">'\n' + class="st">'-'.repeat(155)); |
| 28 | }; |
| 29 | |
| 30 | const testArrayShift = () => { |
| 31 | let bigArray = makeBigArray(); |
no test coverage detected