Let bindings from thbe macroexpansion of (let [[x & xs] v] ...)
;; old macroexpand
[G__1 v
vec__2 G__1
x (nth vec__2 0 nil)
xs (nthnext vec__2 1)]
;; new macroexpand
[G__6 v
vec__7 G__6
seq__8 (seq vec__7)
first__9 (first seq__8)
seq__8 (next seq__8)
x first__9
xs seq__8]
On Wednesday, June 1, 2016 at 7:49:00 PM UTC-4, Frank Castellucci wrote:
>
>
> How was this accomplished?
>
> On Wednesday, June 1, 2016 at 10:17:14 AM UTC-4, Rich Hickey wrote:
>>
>> 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
>>
>> > On May 31, 2016, at 11:41 AM, Stuart Halloway <[email protected]>
>> wrote:
>> >
>> > Clojure 1.9.0-alpha4 is now available.
>> >
>> > Try it via
>> >
>> > - Download:
>> https://repo1.maven.org/maven3/org/clojure/clojure/1.9.0-alpha4
>> > - Leiningen: [org.clojure/clojure "1.9.0-alpha4"]
>> >
>> > 1.9.0-alpha4 includes the following changes since 1.9.0-alpha3:
>> >
>> > - fix describe empty cat
>> > - improve update-in perf
>> > - optimize seq (&) destructuring
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to [email protected]
>> > Note that posts from new members are moderated - please be patient with
>> your first post.
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> > 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 [email protected].
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.