Categories
JavaScript Vue.js

Measure function execution time

Background:

Need to call a button click function in the child component from parent.

Two methods:

  • Call method in the child component
  • Trigger click event on the button of the child element

Want to compare performance of these two methods.

console.time('doSomething')

doSomething()   // <---- The function you're measuring time for 

console.timeEnd('doSomething')

https://stackoverflow.com/questions/313893/how-to-measure-time-taken-by-a-function-to-execute

Leave a comment