Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

benchmark beginings

  • Loading branch information...
commit 7b64084e25ede753e69cf0d4ad34b6125aae702e 1 parent f39becd
@tmpvar authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 benchmark/mark.js
  2. 0  benchmark/stats.json
View
23 benchmark/mark.js
@@ -0,0 +1,23 @@
+// Taken from: http://ejohn.org/blog/javascript-benchmark-quality/
+module.exports = runTest(name, test, next, callback){
+ var runs = [], r = 0;
+ setTimeout(function(){
+ var start = Date.now(), diff = 0;
+
+ for ( var n = 0; diff < 1000; n++ ) {
+ test();
+ diff = Date.now() - start;
+ }
+
+ runs.push( n );
+
+ if ( r++ < 4 )
+ setTimeout( arguments.callee, 0 );
+ else {
+ done(name, runs);
+ if ( next )
+ setTimeout( next, 0 );
+ }
+ }, 0);
+}
+
View
0  benchmark/stats.json
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.