Hi, I just ran these two microbenchmarks, where I attempted to measure the overhead in Clojure's loop-recur form as compared to just mutating an array.
;;loop-recur (5300 msecs) (time (dotimes [n 5000] (loop [accum (int 0) i (int 0)] (if (< i 50000) (recur (+ accum i) (inc i)) accum)))) ;;int-array (2910 msecs) (time (dotimes [n 5000] (let [a (int-array 1)] (dotimes [i 50000] (aset a 0 (+ i (aget a 0))))))) Because of these results, I think it's worthwhile to be able to access a mutable location directly from within Clojure, such as a mutable primitive. Right now, I'm making do with a set of macros for creating and manipulating 1 element arrays. But this incurs a cost of creating those arrays when I really just want a mutable primitive. What is everyone's opinion on this? Are mutable primitives still seen as unnecessary? Or are they seen as necessary but not an immediate concern? -Patrick -- 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