I believe that this is most likely a symptom of the Apple JVM and not
that of transients
as the change from persistents to transients is far more substantial
on one of our linux
servers than it is on my macbook pro (6x vs 2x speedup)

I'm not entirely sure as to why this is the case but I suspect that GC
has something to
do with it as the following example, which simply bumps a counter in a
map, exhibits
the more impressive performance improvement

(defn make-n [x n]
  (loop [i 0 v []]
    (if (< i n)
      (recur (inc i) (conj v x))
      v)))

(defn make-n2 [x n]
  (loop [i (int 0) v (transient [])]
    (if (< i n)
      (recur (inc i) (conj! v x))
      (persistent! v))))

(dotimes [x 10]
  (do (System/gc) (time (make-n 1 100000)) 1))

(dotimes [x 10]
  (do (System/gc) (time (make-n2 1 100000)) 1))



On Nov 23, 9:07 pm, Raoul Duke <rao...@gmail.com> wrote:
> i have tried:
>
> 1.5
> 1.6
> 1.6 -server
> the last i did both in repl-in-emacs, and in a repl-in-straightup-shell.
>
> the numbers i get are weird. it does seem like v2 is faster than v,
> but never gets stupendously fast (never faster than 500 msec on a dual
> core macbook pro 2.2ghz core 2 duo 4gb ram), and v does a strange
> thing where i run v2 a bunch then the first time i run v it is like 2x
> v2, and then subsequent runs of timing v are like 8x v2. and here i
> thought hotspot was supposed to get faster, not slower, over time.
>
> oy veh.

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

Reply via email to