Re:CoffeeScript: The beautiful way to write JavaScript
by seanalltogether on Tuesday March 08, 2011 @06:06PM
(#2302977)
Also, with a language like javascript, shouldn't we worry more about faster performance then beautiful syntax.
[ Parent
| on HN ]
Re:CoffeeScript: The beautiful way to write JavaScript
by jashkenas on Tuesday March 08, 2011 @07:27PM
(#2303234)
Absolutely, and CoffeeScript worries about your JS performance for you, when it can. In my personal experience, translating JS to Coffee tends to speed up the performance of the resulting script, due to the optimizations the CoffeeScript compiler adds.
To be specific, the main speedup I tend to get is this: If I'm working with JS, I'll tend to use a "forEach" function frequently, for looping over lists:
list.forEach(function(item){ item.transform(); });
In CoffeeScript, you'd write it like this: item.transform() for item in list
... and instead of the slow "forEach" function, you get a much faster native "for" loop.