Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wonder to what extent the speed increase was due to Clojure vs the JVM itself.

An interesting comparison might have been Clojure vs their previous code on JRuby.



In my code, there are two kinds of places where I get a performance boost by using Clojure:

1. Micro-optimizations, mostly due to JVM and its excellent JIT (the garbage collectors are quite impressive, too, if what you need is predictable response time).

2. Architectural gains: thanks to the Clojure's excellent concurrency support I can make much better use of multiple cores. I get more parallellism, hence better performance on same hardware.

The first kind is cool, because you get it "for free". The second kind is the real game-changer, because non-parallel software only gets you so far in terms of performance, and writing concurrent software is Hard. Clojure makes it much, much easier.

But overall I wouldn't say that Clojure is a performance daemon on a single CPU. You can get performance similar to carefully written Java code. This is good, but you can always do better with C or hand-written assembly on critical sections. But that's not the main advantage: the big thing is that I can write correct Clojure code fast, it runs well enough, and I can easily make use of multiple cores. You can debate micro-benchmarks all you want, but what really counts for me is how quickly (and correctly) I can get from zero to production code that runs fast enough.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: