Re:Why You Should Always Use === and Other Bad Practices
by inglor on Sunday February 09, 2014 @07:12PM
(#7208186)
"Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%." - Knuth
Micro benchmarks are not how we optimize - we profile.
Re:Why You Should Always Use === and Other Bad Practices
by Eiwatah4 on Monday February 10, 2014 @09:04AM
(#7211082)
Who says the function call actually happens? If the function is short enough, they are a very good candidates for the JIT to inline. If they aren't short, the overhead of calling the function shouldn't matter much anymore.
I agree 1000-fold that the Array manipulation techniques are extremely easy to read. Keep in mind though, you are creating a new copy of the [1-n]array through the slicing, and the overhead of the function call with forEach will matter on large Arrays. Really depends what you are building. Don't call performance optimization worthless.