devtools-benchmarker
v0.1.3
Published
tool for developers test functions execution time
Downloads
8
Maintainers
Readme
devtools - benchmarker - developer tool to measure javascript functions execution time
Install
With npm:
npm install devtools-benchmarker
With yarn:
yarn add devtools-benchmarker
Usage
const benchmarker = require('devtools-benchmarker')
// Function to Test
const somefunction = function () {
// Some Complex Things
for (let i = 0; i < 100; i++) {
for (let j = 0; j < 100; j++) {
var someComplexCalc = Math.random * 1000 + Math.random * 1000
}
}
}
// set precision of measured value
benchmarker.setPrecision(4)
// Measure execution time of function
console.log(benchmarker.measure(somefunction))
Result:
License
MIT