Skip to content

Instantly share code, notes, and snippets.

@mourner
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mourner/2bba4381d52c454e1b66 to your computer and use it in GitHub Desktop.
Save mourner/2bba4381d52c454e1b66 to your computer and use it in GitHub Desktop.
simple benchmarking snippet for v8 & node
function test() {
for (var i = 0, array = []; i < 1000; i++) array.push(i, i);
}
var start = Date.now(), ops = 0;
do { test(); ops++; } while (Date.now() - start < 1000);
(typeof console !== 'undefined' ? console.log : print)(ops + ' ops/s');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment