3 ms·
Sure. This would be a reason not to use splatted arguments in performance-intensive functions, since foo = (first, middle..., last) -> relies on `Array.pr
by TrevorBurnham 15y ago
Sure. 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."