Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 886 Bytes

README.md

File metadata and controls

44 lines (31 loc) · 886 Bytes

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:
example

License

MIT