// Runs a function many times without the function call overheadfunctionbenchmark(fn,times,name){fn=fn.toString();vars=fn.indexOf('{')+1,e=fn.lastIndexOf('}');fn=fn.substring(s,e);returnbenchmarkString(fn,times,name);}functionbenchmarkString(fn,times,name){varfn=newFunction("i","var t=new Date; while(i--) {"+fn+"}; return new Date - t")(times)fn.displayName=name||"benchmarked";returnfn;}