Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Created December 22, 2014 23:18
Show Gist options
  • Save masakielastic/67a2b20de5b0d5c9bb6c to your computer and use it in GitHub Desktop.
Save masakielastic/67a2b20de5b0d5c9bb6c to your computer and use it in GitHub Desktop.
var benchmark = function(callback) {
var max = 1000000;
var start = Date.now();
for (var i = 0; i < max; ++i) {
callback();
}
var end = Date.now();
return end - start;
};
var f = function() {
var a = 1 + 1;
}
console.log(benchmark(f));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment