angular.js/perf/testUtils.js
Igor Minar e3ddc2bcc4 simple perf testing harness with JSON parsing tests
- all tests should be under perf/
- all payloads should be under perf/data
- run tests with ./server.sh + ./test-perf.sh

We still lack a way to compare results against a baseline, but
this is better than nothing.
2010-12-22 14:16:36 -08:00

20 lines
No EOL
324 B
JavaScript

if (window.jstestdriver) {
jstd = jstestdriver;
dump = angular.bind(jstd.console, jstd.console.log);
}
function time(fn, times) {
times = times || 1;
var i,
start,
duration = 0;
for (i=0; i<times; i++) {
start = Date.now();
fn();
duration += Date.now() - start;
}
return duration;
}