Commit 5d2e0efd authored by jeresig's avatar jeresig

Reformat benchamrk function.

parent be2407e2
// Runs a function many times without the function call overhead function benchmark(fn, times){ fn = fn.toString() var s = fn.indexOf('{')+1, e = fn.lastIndexOf('}'); fn = fn.substring(s,e); return new Function('i','var t=new Date;while(i--){'+fn+'};return new Date-t')(times); }
\ No newline at end of file
// Runs a function many times without the function call overhead
function benchmark(fn, times){
fn = fn.toString();
var s = fn.indexOf('{')+1,
e = fn.lastIndexOf('}');
fn = fn.substring(s,e);
return new Function('i','var t=new Date;while(i--){'+fn+'};return new Date-t')(times);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment