Skip to content

Instantly share code, notes, and snippets.

@tricknotes
Created December 10, 2012 09:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tricknotes/4249528 to your computer and use it in GitHub Desktop.
Save tricknotes/4249528 to your computer and use it in GitHub Desktop.
Performance check about arguments
var now;
var fn, i;
var count = 10000000;
now = Date.now();
fn = function() {
arguments[0];
}
for (i = 0; i < count; i++) {
fn();
}
console.log('arguments[0]:\n %d ms', Date.now() - now);
now = Date.now();
fn = function(type) {
type;
}
for (i = 0; i < count; i++) {
fn();
}
console.log('assigned variable:\n %d ms', Date.now() - now);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment