1 define([ ], function () {
2 // Benchmarks fn until maxTime ms has passed. Returns approximate number
3 // of operations performed in that time ('score').
4 function bench(maxTime, fn) {
5 if (typeof fn !== 'function') {
6 throw new TypeError('Argument must be a function');
9 var operationCount = 0;
10 var startTime = Date.now();
17 if (endTime - startTime >= maxTime) {
22 return operationCount / (endTime - startTime) * maxTime;