I'm not sure whether this belongs on StackOverflow or in the Clojure Google group. But the group seems to be busy discussing numeric improvements for Clojure 1.2, so I'll try here:
http://shootout.alioth.debian.org/ has a number of performance benchmarks for various languages.
I noticed that Clojure was missing, so I made a Clojure version of the n-body problem.
The fastest code I was able to produce can be found here, and benchmarking it seems to be saying that for number crunching Clojure is
I'm quite happy with that level of performance.
My question to the Clojure gurus is
Update
More Clojure 1.1 benchmark programs for the shootout here, including the n-body problem.
Not a flood of responses here :) but apparently some interest, so I'll try to answer my own question with what I've learned over the past few days:
definterface
and deftype
are more than twice as fast, coming within ~1.7x (+70%) of Java with shorter, simpler and cleaner code than for 1.1.Here are the implementations:
More details including "lessons learned", JVM version and profiling screenshots.
Subjectively speaking, optimizing the 1.2 code was a breeze compared to optimizing 1.1, so this is very good news for Clojure number crunching. (Actually close to amazing :)
The 1.2 testing used the current master branch, I did not try any of the new numeric branches. From what I can gather the new ideas currently being discussed
Disclaimers:
I wonder if Cantor might be of use to you -- it's a high performance math library for Clojure. Also see this thread on the Google group, which is about a similar project in the context of the new primitive arithmetic stuff.
This is a slightly old question and the existing answers are somewhat out of date, so I'd like to add an update as of mid-2013 for those interested in "number crunching" in Clojure
There has been a lot happening in the Clojure Numerical computing space:
Disclaimer: I'm a maintainer / contributor to several of the above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With