Re:Arguments Object: Doctor Jekyll and Mister Hyde in Node.js
by TrevorBurnham on Saturday July 16, 2011 @01:50PM
(#2771219)
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."
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."