MCPcopy
hub / github.com/mongodb/node-mongodb-native / printHistogram

Function printHistogram

test/benchmarks/unitBench/list.bench.js:10–28  ·  view source on GitHub ↗
(name, h)

Source from the content-addressed store, hash-verified

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

Callers 6

testArrayShiftFunction · 0.85
testListShiftFunction · 0.85
testDenqueShiftFunction · 0.85
testArrayPushFunction · 0.85
testListPushFunction · 0.85
testDenquePushFunction · 0.85

Calls 3

makeReadableTimeFunction · 0.85
logMethod · 0.80
writeMethod · 0.65

Tested by

no test coverage detected