I just uploaded to the group an implementation of the n-body benchmark
in Clojure (see nbody_init.clj)

http://shootout.alioth.debian.org/u32/benchmark.php?test=nbody&lang=java&box=1

My goal was to write a pure-functional version and to avoid any micro-
optimizations. There are no type declarations and plenty of laziness
and higher-order functions.

It seems to be 100 times slower than Java (I was expecting worse) on
my machine, putting it in the same class as Ruby, Perl and Python
(which are imperative).

The obvious things to do next here, in the order of ugliness, are:

1. switch to 3D vectors instead of arbitrary length functions
2. add type declarations
3. avoid maps
4. experiment with adding/removing "(vec ..."
5. get imperative or transient
6. switch to Java arrays/classes

I am curious about how much more "non-idiomatic" Clojure has to become
here for each step it takes towards Java-like performance in this
benchmark, and whether the most optimized version will match Java in
speed.

I hope others can pick this up and implement the optimizations, or
post their timings.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to