4 ms·
hmmm... anybody knows if this is an issue for coffeescript generated javascript, too?
by bauchidgw 15y ago
hmmm... anybody knows if this is an issue for coffeescript generated javascript, too?
- chapel 15y agoDepends on what javascript is generated. If it has a similar scenario to what was described in the post, then yeah it would cause problems.
- TrevorBurnham 15y agoSure. This would be a reason not to use splatted arguments in performance-intensive functions, since foo = (first, middle..., last) -> relies on `Array.prototype.slice(arguments)` to transform arguments into an array. You could accomplish the same thing using a loop over arguments instead, or better yet, design your code so that the function can take a fixed number of arguments instead (just use an array as the second argument). But remember, this is only going to matter for functions that are called thousands of times in a short time period. Elegant code is usually better than efficient code. "Premature optimization is the root of all evil."