brolly
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -58,10 +58,14 @@ 'use strict'; | ||
p.then(result => { | ||
console.log(`total ${time()}`); | ||
console.log(`total ${time()}\n`); | ||
result.forEach((obj, i) => { | ||
if (obj.success) { | ||
console.log(`${names[i]}: ${obj.result}ms (average)`); | ||
const { avgExecTime, opsPerSec } = obj.result; | ||
console.log(`- ${names[i]}:`); | ||
console.log(` avg time: ${avgExecTime}ms`); | ||
console.log(` ops/sec: ${opsPerSec}`); | ||
} else { | ||
console.log(`${names[i]}: failed (${obj.error})`); | ||
console.log(`- ${names[i]}:`); | ||
console.log(` failed (${obj.error})`); | ||
} | ||
console.log(); | ||
}); | ||
@@ -68,0 +72,0 @@ }); |
@@ -36,3 +36,4 @@ 'use strict'; | ||
let sum = 0; | ||
const runTime = timer('s'); | ||
let execTime = 0; | ||
let completed = 0; | ||
@@ -50,6 +51,9 @@ | ||
cbCalled = true; | ||
sum += time(); | ||
execTime += time(); | ||
if (++completed === iterations - 1) { | ||
success(parseInt(sum / iterations)); | ||
success({ | ||
avgExecTime: parseInt(execTime / iterations), | ||
opsPerSec: (iterations / runTime()).toLocaleString(undefined, { maximumFractionDigits: 0 }) | ||
}); | ||
} | ||
@@ -56,0 +60,0 @@ }; |
{ | ||
"name": "brolly", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "benchmark in style", | ||
@@ -5,0 +5,0 @@ "main": "bin/index.js", |
@@ -63,10 +63,14 @@ 'use strict' | ||
p.then((result) => { | ||
console.log(`total ${time()}`) | ||
console.log(`total ${time()}\n`) | ||
result.forEach((obj, i) => { | ||
if (obj.success) { | ||
console.log(`${names[i]}: ${obj.result}ms (average)`) | ||
const {avgExecTime, opsPerSec} = obj.result | ||
console.log(`- ${names[i]}:`) | ||
console.log(` avg time: ${avgExecTime}ms`) | ||
console.log(` ops/sec: ${opsPerSec}`) | ||
} else { | ||
console.log(`${names[i]}: failed (${obj.error})`) | ||
console.log(`- ${names[i]}:`) | ||
console.log(` failed (${obj.error})`) | ||
} | ||
console.log() | ||
}) | ||
@@ -73,0 +77,0 @@ }) |
@@ -36,3 +36,4 @@ 'use strict' | ||
let sum = 0 | ||
const runTime = timer('s') | ||
let execTime = 0 | ||
let completed = 0 | ||
@@ -50,6 +51,9 @@ | ||
cbCalled = true | ||
sum += time() | ||
execTime += time() | ||
if (++completed === iterations - 1) { | ||
success(parseInt(sum / iterations)) | ||
success({ | ||
avgExecTime: parseInt(execTime / iterations), | ||
opsPerSec: (iterations / runTime()).toLocaleString(undefined, {maximumFractionDigits: 0}) | ||
}) | ||
} | ||
@@ -56,0 +60,0 @@ } |
Sorry, the diff of this file is not supported yet
51871
294