This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// count time needed to execute a function | |
// precisition is 0.0001 ms | |
const countTime = (func) => { | |
const startTime = performance.now(); | |
func(); | |
const endTime = performance.now(); | |
const timeNeeded = endTime - startTime; | |
console.log(`${func.name} needed ${timeNeeded.toFixed(4)} ms`); | |
} |