4 ms·
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 libra
by yonran 15y ago
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.
- mraleph 15y agoArguments misuse will ruin performance if the code is hot.
- yonran 15y agoI would hesitate to call the use of an object as defined in the ECMAscript spec "misuse." Perhaps it is becoming a best practice to avoid it, but it's not misuse yet until we know that it causes an unavoidable performance degradation. The lesson here is that one feature of V8 is an arguments optimization, but you must never pass the object to other functions (i.e., you have to manually inline the calls you would have made).