To give people an idea of the update-in and seq destructuring improvements:
(let [d3 {:a {:b {:c 2}}}]
(dotimes [_ 10]
(time (dotimes [_ 10000000]
(update-in d3 [:a :b :c] inc)))))
;;;;;;;;;;; 1.9 alpha3 ;;;;;;;;;;;;;;
user=> "Elapsed time: 6489.189065 msecs"
"Elapsed time: 6501.518961 msecs"
"Elapsed time: 6479.994554 msecs"
"Elapsed time: 6477.236659 msecs"
"Elapsed time: 6490.542382 msecs"
"Elapsed time: 6494.044657 msecs"
"Elapsed time: 6475.188285 msecs"
"Elapsed time: 6498.734628 msecs"
"Elapsed time: 6486.312312 msecs"
"Elapsed time: 6476.566904 msecs"
nil
;;;;;;;;;;; 1.9 alpha4 ;;;;;;;;;;;;;;
user=> "Elapsed time: 1613.631053 msecs"
"Elapsed time: 1614.271583 msecs"
"Elapsed time: 1607.393994 msecs"
"Elapsed time: 1605.966032 msecs"
"Elapsed time: 1605.731867 msecs"
"Elapsed time: 1605.836779 msecs"
"Elapsed time: 1617.090363 msecs"
"Elapsed time: 1611.065741 msecs"
"Elapsed time: 1611.249945 msecs"
"Elapsed time: 1624.351585 msecs"
nil
(let [v (into [] (range 1000000))]
(dotimes [_ 10]
(time (dotimes [_ 10]
(loop [[x & xs] v]
(if xs
(recur xs)
x))))))
;;;;;;;;;;; 1.9 alpha3 ;;;;;;;;;;;;;;
user=> "Elapsed time: 1531.858419 msecs"
"Elapsed time: 1521.997662 msecs"
"Elapsed time: 1499.931748 msecs"
"Elapsed time: 1499.745901 msecs"
"Elapsed time: 1496.63342 msecs"
"Elapsed time: 1499.363234 msecs"
"Elapsed time: 1506.309383 msecs"
"Elapsed time: 1514.943316 msecs"
"Elapsed time: 1534.90731 msecs"
"Elapsed time: 1524.550125 msecs"
nil
;;;;;;;;;;; 1.9 alpha4 ;;;;;;;;;;;;;;
user=> "Elapsed time: 155.544283 msecs"
"Elapsed time: 131.861647 msecs"
"Elapsed time: 141.774727 msecs"
"Elapsed time: 238.939786 msecs"
"Elapsed time: 294.832594 msecs"
"Elapsed time: 278.476703 msecs"
"Elapsed time: 133.259029 msecs"
"Elapsed time: 139.917267 msecs"
"Elapsed time: 137.444001 msecs"
"Elapsed time: 147.852057 msecs”
nil
The code now produced for [x & xs] style destructuring is now as good as the best first/next code you could write by hand, while the code produced for [x y z] destructuring of indexed items is the same (fast, indexed) as always.
Rich
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to
clo...@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+u...@googlegroups.com
> For more options, visit this group at
>
http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
clojure+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.