On Sun, Nov 14, 2010 at 2:42 PM, Ken Wesson <kwess...@gmail.com> wrote:
> user=> (let [iterations 100000000] (time (dotimes [_ iterations]
> (= [] (pop [3])))) (time (dotimes [_ iterations] (seq []))))
> "Elapsed time: 29994.93852 msecs"
> "Elapsed time: 2745.21924 msecs"

It occurred to me that the JIT might not be hoisting the constant (pop
[3]) out of the loop so I retested with this:

user=> (let [iterations 100000000 ev (pop [3])] (time (dotimes [_ iterations]
(= [] ev))) (time (dotimes [_ iterations] (seq []))))
"Elapsed time: 16477.68672 msecs"
"Elapsed time: 2105.01128 msecs"

Still nearly 10x slower. The JIT did something (optimized the function
call overhead away, most likely) but it didn't hoist the entire thing,
and most of the time is indeed spent in the = test.

= is damned slow.

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