On 23.03.2010, at 08:55, Raph wrote:

> I have tried various hinting methods, but I cannot increase the speed.
> What can I do to make the clojure operations as fast as the native
> Java operations?

Get rid of the reduce and unroll the bit-or computations instead:

(defn arr-to-int [#^ints x]
 (bit-or (bit-shift-left (bit-and 0xFF (aget x 0)) 24)
         (bit-or (bit-shift-left (bit-and 0xFF (aget x 1)) 16)
                 (bit-or (bit-shift-left (bit-and 0xFF (aget x 2)) 8)
                         (bit-and 0xFF (aget x 3))))))

That makes for a factor 3.3 on my machine.

Konrad.

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to