On Wed, Jul 8, 2009 at 4:57 PM, Frantisek Sodomka <fsodo...@gmail.com>wrote:

>
> So far it seems that vectors win in Clojure:
>
> (timings 3e5
>  (let [v (vector 1 2 3) a (nth v 0) b (nth v 1) c (nth v 2)] (+ a b
> c))
>  (let [lst (list 1 2 3) a (nth lst 0) b (nth lst 1) c (nth lst 2)] (+
> a b c)))
>
> =>
>  680.63 ms   83.6%   1.2x  (let [v (vector 1 2 3) a (nth v 0) b (nth
> v 1) c (nth v 2)] (+ a b c))
>  813.79 ms  100.0%   1.0x  (let [lst (list 1 2 3) a (nth lst 0) b
> (nth lst 1) c (nth lst 2)] (+ a b c))
>

Does using vec instead of vector make a difference? Using first, rest,
first, rest instead of nth to destructure the list?

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