Hello,

I tried to inline everything in the main loop (the updaters loops) and
obtained on my machine a 15% speed-up.

One of the possible slowdown may come from having arrays and not object.
Maybe, each access need to perform a size check on the array. Which is
not very costly but not negligible when you have very few operations on
each elements.

I read Hot Spot removes checks when it can decide they are useless. But
it is not clear in this program they are useless.
(You take an array in a structure in each iteration and access fields
from 0 to 6. If the size is not known then it has to test acces for 1,
then 2, then 3...)
Maybe you could try each time you take a [b (bodies i)] to check that
it's size is at least 7. If Hot Spot is clever enough it would reduce
the number of checks. 
I am not sure it would do much good though, but I would like to know.

Else, you could try to put everything in one big array, and replace
bodies by their index. I wonder whether there would be a speed-up or not
from removing indirections.

Best,

Nicolas.

On Wed, 2009-08-12 at 00:26 -0400, Aaron Cohen wrote: 
> On Tue, Aug 11, 2009 at 8:13 PM, Andy
> Fingerhut<andy_finger...@alum.wustl.edu> wrote:
> >
> > On Aug 11, 2:36 pm, Aaron Cohen <remled...@gmail.com> wrote:
> >> At that point is it possible you're just paying the price of
> >> PersistentVector for the "bodies" vector?  Does it improve much if you
> >> change bodies to an array?
> >
> > About 7% faster changing bodies to a Java array of java.lang.Object's,
> > each of which happens to be a Java array of primitive doubles, as
> > before.  Now about 3.0 x Java run time.
> >
> > http://github.com/jafingerhut/clojure-benchmarks/blob/43ed2f42e6c1485541532e51eacc66488949c658/RESULTS
> >
> 
> I'm actually glad that the difference is that small there.
> 
> > 


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