Created
January 18, 2011 23:19
-
-
Save aheckmann/785364 to your computer and use it in GitHub Desktop.
arguments.callee is slower than a named function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var index; | |
function test (method) { | |
index = 0; | |
var start = new Date; | |
var i = 1000000; | |
while (--i) method(); | |
console.log(new Date - start); | |
} | |
test(function named () { | |
named.k = index++; | |
}) | |
test(function(){ | |
arguments.callee.k = index++; | |
}) | |
----------------------- | |
// results | |
----------------------- | |
named: 16ms | |
arguments.callee: 30ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment