Hacker News new | ask | show | jobs
by raphinou 4653 days ago
Did you test statically typed groovy? Does it have better performance?

As for clojure, how does its performance compare to groovy?

Really interested to know more!

1 comments

Clojure can be exactly as fast as Java within a function when type hints are used to avoid reflection. Calling Clojure functions has a little overhead relative to calling Java methods.

That said, an idiomatic system in Clojure will likely have a very different design than it would in Groovy or Java. Using Clojure's built-in immutable data structures, it's cheap in terms of CPU and memory to make a large number of modified copies or to concurrently access data compared to the standard collections in Java and Groovy. Single-threaded reading and writing are, however somewhat more expensive.

My prediction is that it's easier to get good performance out of a system with a lot of concurrency using Clojure than it is with Groovy or Java, though with careful design, it's possible to get better performance with Java.