No you didn't misinterpret it, I thought that would have been the
cause.  I ran a test and I think the de-structuring might have
something to do with it.  Here's the test:

(defn count-slow [[x & xs] acc]
  (if (empty? xs) (inc acc) (recur xs (inc acc))))

(defn count-fast [xs acc]
  (if (empty? (rest xs)) (inc acc) (recur (rest xs) (inc acc))))

(time (count-fast (range 1E8) 0))
"Elapsed time: 48769.773688 msecs"
100000000

(time (count-slow (range 1E8) 0))
"Elapsed time: 88276.491181 msecs"
100000000

(time (count (range 1E8)))
"Elapsed time: 33762.022887 msecs"
100000000

Still doesn't explain the >3-fold difference though.

I included count there out of curiosity, don't have time to look at
the code at work, but I am now intrigued by how it improves on my
version :)

Cheers

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