Just to highlight what for me was non-obvious but interesting. It implies that this change in two places made a significant improvement to their performance stats. Basically, the optimizing compiler is finicky about the arguments object especially if it is used out of bounds. Without that knowledge, the change seems non-intuitive. I wonder if this true for all pseudo-arrays?<p>Old Code:<p><pre><code> var args = Array.prototype.slice.call(arguments, 1);
</code></pre>
New Code:<p><pre><code> var l = arguments.length;
var args = new Array(l - 1);
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];</code></pre>
Funny how the commit for this change had no accompanying comment - this particular change begs for a clear comment!<p><a href="https://github.com/joyent/node/commit/91f1b250ecb4fb8151cd17423dd4460652d0ce97" rel="nofollow">https://github.com/joyent/node/commit/91f1b250ecb4fb8151cd17...</a>
Does this mean that passing the arguments object to any function (even Array.prototype.slice) will ruin your performance? This is extremely common in many libraries' bind/partial functions e.g. Underscore, Closure, var_args in Coffeescript.