force ALL on lists to realize lazy sequence, fix benchmark

This commit is contained in:
nathanmarz 2017-04-11 11:58:52 -04:00
parent a113946076
commit ee56ddc1ab
3 changed files with 4 additions and 4 deletions

View file

@ -2,7 +2,7 @@
* Add `satisfies-protpath?` * Add `satisfies-protpath?`
* Inline cache vars are marked private so as not to interfere with tooling * Inline cache vars are marked private so as not to interfere with tooling
* Improve performance of ALL transform on lists by 7x * Improve performance of `ALL` transform on lists by 20%
* Bug fix: Using `pred` no longer inserts unecessary `coerce-nav` call at callsite * Bug fix: Using `pred` no longer inserts unecessary `coerce-nav` call at callsite
* Bug fix: Dynamic navs in argument position to another nav now properly expanded and compiled * Bug fix: Dynamic navs in argument position to another nav now properly expanded and compiled
* Bug fix: Dynamic parameters nested inside data structures as arguments are now compiled correctly by inline compiler * Bug fix: Dynamic parameters nested inside data structures as arguments are now compiled correctly by inline compiler

View file

@ -55,7 +55,7 @@
(println "\n********************************\n")))) (println "\n********************************\n"))))
(defn specter-dynamic-nested-get [data a b c] (defn specter-dynamic-nested-get [data a b c]
(select-any [(keypath a) (keypath b) (keypath c)] data)) (select-any (keypath a b c) data))
(defn get-k [k] (fn [m next] (next (get m k)))) (defn get-k [k] (fn [m next] (next (get m k))))
@ -138,7 +138,7 @@
(let [data '(1 2 3 4 5)] (let [data '(1 2 3 4 5)]
(run-benchmark "transform values of a list" 500000 (run-benchmark "transform values of a list" 500000
(transform ALL inc data) (transform ALL inc data)
(sequence (map inc) data) (doall (sequence (map inc) data))
(reverse (into '() (map inc) data)) (reverse (into '() (map inc) data))
)) ))

View file

@ -55,7 +55,7 @@
(defn- all-transform-list [structure next-fn] (defn- all-transform-list [structure next-fn]
(sequence (comp (map next-fn) (filter not-NONE?)) structure)) (doall (sequence (comp (map next-fn) (filter not-NONE?)) structure)))
(extend-protocol AllTransformProtocol (extend-protocol AllTransformProtocol
nil nil