Move busui to seperate repository
[bus.git] / jquery.benchmark.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// based on methodology developed by PPK:
// http://www.quirksmode.org/blog/archives/2009/08/when_to_read_ou.html
(function($){
$.benchmark = function(n, contestant, test){
  var startTime = new Date().getTime();
  
  while (n--)
    contestant.benchmarks[test].call(contestant.templates);
 
  setTimeout(function () {
    var endTime = new Date().getTime();
    var result = (endTime-startTime)/1000;
    contestant.results.push(result);
  },10);
};
})(jQuery);