Benny Tsai wrote: > Nice! That version runs in 6 milliseconds on my machine, fastest of > all the code posted so far. One more idea: use 'unchecked-inc' > instead of 'unchecked-add'. This takes it under 3 milliseconds in my > tests. > > (defn java-like [^bytes cpu_array] > (let [buffer-size (int buffer-size)] > (loop [i (int 0)] > (if (< i buffer-size) > (let [i2 (unchecked-inc i) > i3 (unchecked-inc i2) > i4 (unchecked-inc i3) > a (aget cpu_array i4)] > (amove cpu_array i3 i4) > (amove cpu_array i2 i3) > (amove cpu_array i i2) > (aset cpu_array i a) > (recur (unchecked-inc i4))))))) >
Yes, that speeds it up considerably. If I can get Java server installed on my machine, I'll post some 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