Hacker News new | past | comments | ask | show | jobs | submit login

Clojure can be as fast as Java on benchmark-type code using type hints, Java interop and unchecked math. Idiomatic Clojure code will be slower on benchmarks. Operations on persistent data structures are slower than mutation. Reflection takes time.

Back in the real world, Clojure actually does pretty well for itself. As an example, it seems to be fairly common to generate collections of various types and then only use part of them. In Clojure, most of the time those collections would be lazy, saving computations every time the whole thing isn't needed. Also, using clojure.parallel, many operations can be parallelized trivially. I got a 50% speedup running a genetic algorithm on a dual-core machine just by changing a sort to psort.

Of course, hand-optimized Java may still be faster, but Clojure makes it easier.




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

Search: