Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: chrome/test/data/third_party/spaceport/js/util/bench.js

Issue 10154006: Add test data for spaceport benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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');
7 }
8
9 var operationCount = 0;
10 var startTime = Date.now();
11 var endTime;
12 while (true) {
13 fn(operationCount);
14 ++operationCount;
15
16 endTime = Date.now();
17 if (endTime - startTime >= maxTime) {
18 break;
19 }
20 }
21
22 return operationCount / (endTime - startTime) * maxTime;
23 }
24
25 return bench;
26 });
OLDNEW
« no previous file with comments | « chrome/test/data/third_party/spaceport/js/unrequire.js ('k') | chrome/test/data/third_party/spaceport/js/util/benchAsync.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698