Andy,

My understanding is that any double that gets stored in a vector or
map is boxed, and therefore, the vast majority of your double
conversions aren't really doing anything, because when you pull them
out of the vector or map, they'll just be Double objects again.

I believe that the biggest reason for the performance difference
between Clojure and Java on this benchmark is that if you use a
Clojure data structure (e.g., a map) to represent each "body" object,
you get a lot of boxing and unboxing of the doubles.

So I hypothesize that the biggest bang for the buck is to find a way
in Clojure to create body objects with primitive double fields.  Can
the new new do that?  If not, your best bet may be to represent a body
object as a Java array of several doubles, rather than using a Clojure
map.  The first double could represent the mass, the second could
represent vx, the second vy, and so on.  Make macros for the accessors
that extract these values using aget.

It's speculation on my part, but I think this will get you much closer
to Java speed than your current approach.

--~--~---------~--~----~------------~-------~--~----~
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