Seems to mean that I was wrong and that the cost is both in bound check and unpacking the indices, mostly the second one.
On Mon, 2009-08-17 at 09:25 -0700, Bradbev wrote: > On Aug 17, 1:32 am, Nicolas Oury <nicolas.o...@gmail.com> wrote: > > I was referring to the rules of the benchmark game. When you benchmark > > language, using another language is not fair. > > > > If you were to do your own program, of course you could use Java. > > However, in the particular circumstance, it is a bit annoying to use > > Java just to create a data structure type. > > > Ah, that makes more sense re the "cheating" then. Your insight for > array range check elimination got me thinking - why can't the accessor > macros (posx, etc) that use aset/aget have their ranges eliminated by > the JVM? After all, it should be a simple constant fold. I found > another 2-3x speed up by coercing the indexes with (int x), ie > (defmacro mass [p] `(double (aget ~p (int 0)))) > I don't have the Java version running on my machine, but I saw > runtimes go from 833ms to 295ms for 100000 iterations, a 2.8x speed > up, which should put the "no cheating" version on the same standing as > the Java implementation. > > Cheers, > Brad > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---