Skip to content

Instantly share code, notes, and snippets.

@roshanca
Created April 28, 2020 01:48
Show Gist options
  • Save roshanca/45f62b0d861c9c88e35198550ed769bd to your computer and use it in GitHub Desktop.
Save roshanca/45f62b0d861c9c88e35198550ed769bd to your computer and use it in GitHub Desktop.
measure function exec time
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