Thanks. The unchecked math didn't make any difference. But after I switching to aset I did indeed get to within 4x of Java. Then at the suggestion of Christophe Grand on StackOverflow I switched to .equals instead of = and that got me to ~133% of Java performance. Very close!
On Tuesday, February 19, 2013 2:16:28 AM UTC-5, Andy Fingerhut wrote: > > This won't get you all of the way to Java speeds, or at least it didn't > for me, but try these things: > > Use: > > (set! *warn-on-reflection* true) > (set! *unchecked-math* true) > > The first won't speed anything up, but it will warn you about some things > that are slow. > > The second will use unchecked match wherever it can, meaning primitive > operations on arithmetic values like longs, that will silently wrap instead > of checking for overflow. Java doesn't check for overflow in primitive > operations, either. > > Also use aset instead of aset-int. I don't know why, but the aset-* > operations are typically slower than aset, as long as the type hints on the > aset arguments are good enough. > > I got within 4x Java speed with those changes. > > Andy > > > On Feb 18, 2013, at 8:16 PM, Geo wrote: > > > Hello, > > > > I am cross-posting my Clojure question from StackOverflow. I am trying > to get an algorithm in Clojure to match Java speed and managed to get the > performance to within one order of magnitude and wondering if more is > possible. The full question is here: > > > > > http://stackoverflow.com/questions/14949705/clojure-performance-for-expensive-algorithms > > > > > Thank you. > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.