performance - Varying benchmarks for same function in javascript -
i've started using performance
api in javascript analyze execution time of functions. code given below:
var init,fint; init = performance.now(); functioncall(); fint = performance.now(); console.log(fint-init);
when run code multiple times, each time different outputs though code , values involved same. difference as +80%. (i talking milliseconds, still...).
sample o/p:
6.053819752878553 9.16106501362151 5.987994283801299
is there anyway make these outputs have lesser variance each other? not asking code above, there better alternative profiler? there development environment (i using latest chrome, not many extensions)?
(for instance, iterating in loop , taking average better way go?)
Comments
Post a Comment