3 ms·
This is actually almost completely wrong information. The lower-level for loop is much more JS engine friendly than the Array methods (filter, map etc.). So unl
by amasad 13y ago
This is actually almost completely wrong information. The lower-level for loop is much more JS engine friendly than the Array methods (filter, map etc.). So unless you write JS like it's C, for the most part, CoffeeScript will probably generate more efficient code[1]. As shown in the jsperf by @mischani [2]
The only thing that's true is that CofeeScript generates some throwaway code because of implicit returns and the "everything is an expression" rule. However, I doubt that they would cause much overhead, specially with modern JS engines optimisation capabilities.
[1]: http://mrale.ph/blog/2011/11/05/the-trap-of-the-performance-sweet-spot.html http://mrale.ph/blog/2011/11/05/the-trap-of-the-performance-...
[2]: http://jsperf.com/don-t-use-coffeescript http://jsperf.com/don-t-use-coffeescript
- L8D 13y agoSee my other comment. I too think that using .map, .filter, and .forEach are a bad idea. But also, if you see the code I would have written in the jsperf, I'd guess you say that I write JS like it's C. So, good point.