JavaScript/jQuery simple benchmarking


/ Published in: PHP
Save to your folder(s)

Disable Firebug and plugins, close other tabs and close other programs for more accurate results!


Copy this code and paste it in your HTML
  1. function t() {
  2. var time = new Date();
  3. return time.getTime();
  4. }
  5.  
  6.  
  7. $(document).ready(function() {
  8. var s = t();
  9.  
  10. for (var i=0; i<10000; i=i+1) {
  11. $('#content').html("hello");
  12. }
  13.  
  14. $('#out').append( (t()-s) +'ms');
  15. });
  16.  
  17.  
  18.  
  19.  
  20. <div>
  21. <p>Time: <span id="out"></span></p>
  22. </div>
  23.  
  24. <div>
  25. <p>Content: <span id="content"></span></p>
  26. </div>

URL: http://blog.projekt2k.de/2010/01/benchmarking-jquery-1-4/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.