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

Function printHistogram

test/benchmarks/unitBench/list.bench.js:10–28  ·  test/benchmarks/unitBench/list.bench.js::printHistogram
(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, class="st">' ');
10const 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
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