Apple Lossless Decoder in Coffeescript
github.com
Apple Lossless Decoder in Coffeescript
1–10 of 26 posts
Re: Apple Lossless Decoder in Coffeescript
#2Re: Apple Lossless Decoder in Coffeescript
#3Re: Apple Lossless Decoder in Coffeescript
#4I enjoyed reading this source, and will probably use your Buffer/Stream classes in a project I'm working on. Thanks!
Re: Apple Lossless Decoder in Coffeescript
#5Re: Apple Lossless Decoder in Coffeescript
#6@devongovett: Have you considered pushing the annotated source for this to your "gh-pages" branch? It would make for a great read.
But if someone wants to do it, I think both me and @devongovett would be ready to help out a bit.
(We usually hang out in #ofmlabs on freenode, if someone wants to speak with us)
Re: Apple Lossless Decoder in Coffeescript
#7@devongovett: Have you considered pushing the annotated source for this to your "gh-pages" branch? It would make for a great read.
Re: Apple Lossless Decoder in Coffeescript
#8Re: Apple Lossless Decoder in Coffeescript
#9devongovett/jensnockert: what was your experience with using CoffeeScript for such low level code? Did you need to consciously avoid certain CoffeeScript features that could negatively impact performance?
Otherwise it is pretty similar to javascript, most coffeescript constructs map pretty simply down to javascript, so optimization tips for one language mostly applies to the other.
Re: Apple Lossless Decoder in Coffeescript
#10devongovett/jensnockert: what was your experience with using CoffeeScript for such low level code? Did you need to consciously avoid certain CoffeeScript features that could negatively impact performance?
for i in [0...10]
doSomething()
is slower than for i in [0...10] by 1
doSomething()
because of the way it is compiled, so we always include the `by 1` as an optimization.Another one is that if you have a function and the last thing in that function is a loop of some kind, CoffeeScript will try to return an array from that function collecting the results of the loop. So we explicitly put a return statement at the end of the function to avoid this and the performance penalties.
There are probably a few more to be careful of, but overall performance characteristics are similar to JS. I'm sure Jens has some thoughts too, but overall I think it was a positive experience.