Posted By

vss on 02/26/11


Tagged

time count measure


Versions (?)

Time measure


 / Published in: JavaScript
 

  1. var start = new Date().getTime();
  2.  
  3. for (i = 0; i < 50000; ++i) {
  4. // do something
  5. }
  6.  
  7. var end = new Date().getTime();
  8. var time = end - start;
  9. alert('Execution time: ' + time);

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: vss on February 26, 2011

Also read this post about time measure in JS: http://ejohn.org/blog/accuracy-of-javascript-time/

You need to login to post a comment.