I wish they mentioned performance a bit more. From my personal experiences and almost every benchmark I've ever seen clojure struggles and seems laborious to optimize unless you have a lot of experience with it. I guess it might be comparable to ruby, so it didn't affect them. In my brief use of clojure, the language was very simple and the docs were very easy to use.
I'm also not sure what makes Clojure laborious to optimize. Most optimizations tend to revolve around having reflection and Clojure will warn you about functions that are causing reflection when you set the *warn-on-reflection* flag. On top of that the JVM comes bundled with jvisualvm that can be used to easily profile your application and see what actually needs optimizing.
While, without optimizations, the performance is not going to match Java, it's certainly a lot better than Ruby or Python out of the box.
Clojure does well on the web frameworks benchmark because there's not actually that much Clojure involved. http-kit and most of the libraries in the compojure example are just tiny wrappers around big Java libraries.
The Clojure benchmarks game entries have also been heavily optimized, and they're still slower, more verbose, and use more memory than the Java equivalents. Clojure might be nice, but idiomatic Clojure is definitely not that fast or memory efficient.
"Lua is a tiny and simple language, partly because it does not try to do
what C is already good for, such as sheer performance, low-level operations,
or interface with third-party software. Lua relies on C for those tasks."
You can say idiomatic Clojure isn't fast, but that doesn't mean anything without telling it's what it's slower than. It's still significantly faster than ruby. If you're comparing to java, then it sounds like java isn't even in their consideration when you take into account that they usually use ruby.
Then there's one of Clojure's main benefits. It's often trivial to multithread and as a result you'll multithread things that might not have been worth your time to multithread in other languages including scala.
Clojure does well on the web frameworks benchmark because there's not actually that much Clojure involved. http-kit and most of the libraries in the compojure example are just tiny wrappers around big Java libraries.
That's part of the advantage of being hosted on the JVM. You can wrap Java libraries when you need to and get decent performance. The actual application code can be written using idiomatic Clojure and the overall performance will still be plenty fast.
The Clojure benchmarks game entries have also been heavily optimized, and they're still slower, more verbose, and use more memory than the Java equivalents. Clojure might be nice, but idiomatic Clojure is definitely not that fast or memory efficient.
Idiomatic Clojure certainly isn't as fast or memory efficient as Java, but nobody is arguing that. However, when you compare it to other dynamic languages like Ruby or Python there's a big difference to be seen.
For the vast majority of the code in any application raw performance is not all that interesting in any case. The portions of the code that are actually the bottleneck can be optimized or even written in Java if necessary. However, during the 3 years that I've been developing Clojure professionally I haven't had a reason to do any such optimizations yet.
16
u/strattonbrazil Apr 13 '14
I wish they mentioned performance a bit more. From my personal experiences and almost every benchmark I've ever seen clojure struggles and seems laborious to optimize unless you have a lot of experience with it. I guess it might be comparable to ruby, so it didn't affect them. In my brief use of clojure, the language was very simple and the docs were very easy to use.