6 ms·
Haskell and Clojure are both functional languages with Haskell being purer. That being said, I fairly regularly see posts about how fast Haskell is (Bryan O'Su
by jgalt212 12y ago
Haskell and Clojure are both functional languages with Haskell being purer. That being said, I fairly regularly see posts about how fast Haskell is (Bryan O'Sullivan has a great blog[1]) and I rarely if ever see posts about how fast Clojure is.
What is/are the reason(s) for this? Is it the fault of the JVM, or the bytecode the Clojure compiler emits?
[1] http://www.serpentine.com/blog/ http://www.serpentine.com/blog/
- skittles 12y agoHaskell is strongly and statically typed which means its compiler can generate more optimized code. The compiler also creates programs that run without a virtual machine. Clojure is dynamically typed and runs on the JVM. It is still really fast compared to many other dynamic languages.
- rwosync 12y agoStatic typing is mostly orthogonal, Haskell is mostly blazing fast because of all the aggressive compiler optimizations and the last decade of hard work by Simon Marlow and others on the parallel runtime.
- Ericson2314 12y agoThe second part is true, but that optimization would have been much harder, if not impossible, to implement had they had to rely on some sort of flow analysis instead of static typing.
- tome 12y agoStatic types provide guarantees that help the compiler know when optimizations are valid.
- wereHamster 12y ago> The compiler also creates programs that run without a virtual machine. To be honest, the whole GHC runtime is sortof a VM. It manages thunks, evaluates them etc. It may not have the same overhead as JVM, but there definitely is some.
- jgalt212 12y agoso is Typed Clojure much faster than regular dynamic Clojure?
- taeric 12y agoI would think that few are interested in speed tests of clojure directly. Specifically, I don't think it is a belief that clojure makes things slower than not using clojure on the jvm. At that point, the concern is jvm versus native. And there are plenty of those comparisons. Quickly googling, looks like I may be a wrong, though. So, tough to say.