I copied the code from:
http://clojure.org/transients
but my results are significantly different from what was published.
(defn vrange [n] (loop [i 0 v []] (if (< in) (recur (inc i) (conj vi)) v))) (defn vrange2 [n] (loop [i 0 v (transient [])] (if (< in) (recur (inc i) (conj! vi)) (persistent! v)))) (quick-bench (def v (vrange 1000000))) "Elapsed time: 459.59 msecs" (quick-bench (def v2 (vrange2 1000000))) "Elapsed time: 379.85 msecs"
Is this a bit of an acceleration, but not like an 8x increase in the docs example?
Running java in server mode changes the history, but still nothing like documents.
(quick-bench (def v (vrange 1000000))) "Elapsed time: 121.14 msecs" (quick-bench (def v2 (vrange2 1000000))) "Elapsed time: 75.15 msecs"
Have the persistent implementations improved after reporting transients here: http://clojure.org/transients ?
What other factors can affect the lack of transient stimulus?
I am using java version of OpenJDK 1.7 on ubuntu 12.04. Maybe this is much slower than the (supposed) version of Hotspot 1.6 used in the documents? But doesn't that mean that BOTH tests should be slower with some constant with the same gap?
source share