Created
April 28, 2020 01:48
-
-
Save roshanca/45f62b0d861c9c88e35198550ed769bd to your computer and use it in GitHub Desktop.
measure function exec time
This file contains 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
const measureTime = (cb, ...args) => { | |
const t0 = performance.now() | |
cb(...args) | |
const t1 = performance.now() | |
console.log(`Call to do something took ${t1 - t0} milliseconds.`) | |
} | |
measureTime(myFunction, params) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment