My best guess would be that I've used the loop version in places where I had (set! *unchecked-math* true) - I see that dotimes uses unchecked-inc so that might explain it. See what happens with this version.
(defn inplace-xor [^bytes a ^bytes b ^bytes out] (let [len (alength a)] (loop [i 0] (when (< i len) (aset-byte out i (bit-xor (aget a i) (aget b i))) (recur (*unchecked-*inc i)))))) As someone mentions later in this thread, it really pays to read the compiled bytecode for this stuff and check for boxing. On Thursday, March 13, 2014 7:39:01 AM UTC-5, Michael Gardner wrote: > > On Mar 13, 2014, at 07:34 , Alex Miller <al...@puredanger.com<javascript:>> > wrote: > > > Agreed with all the comments on this so far. I would also say that > dotimes is slower than loop for stuff like this so I would also make that > change. > > The dotimes version is slightly faster on my hardware. Why would it be > slower? -- 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/d/optout.