0.0.5 • Published 5 years ago
@happycodingfriend/benchmark v0.0.5
benchmark
JavaScript benchmark library
Installation
$ npm install @happycodingfriend/benchmark
Example
const Benkcmark = require('@happycodingfriend/benchmark')
const benkcmark = new Benkcmark({ times: 50 })
function add(a, b) {
return new Promise(function (resolve) {
setTimeout(() => {
resolve(a + b)
}, 50)
})
}
benkcmark.test(add, 20, 30)
.then(console.table)
/*
┌─────────┬──────────┐
│ (index) │ Values │
├─────────┼──────────┤
│ times │ 50 │
│ avg │ '50.2ms' │
│ stdev │ '0.40ms' │
│ median │ '50ms' │
│ min │ '50ms' │
│ max │ '51ms' │
└─────────┴──────────┘
*/