Micro optimization: kv run is faster still
This commit is contained in:
parent
1ae8e6c389
commit
ea9286dc90
1 changed files with 5 additions and 5 deletions
|
|
@ -19,8 +19,8 @@
|
||||||
IRecord ISeq]))
|
IRecord ISeq]))
|
||||||
|
|
||||||
(if (vector? taoensso.encore/encore-version)
|
(if (vector? taoensso.encore/encore-version)
|
||||||
(encore/assert-min-encore-version [1 38 0]) ; Note v1.x for Clojure 1.4 support
|
(encore/assert-min-encore-version [2 16 0])
|
||||||
(encore/assert-min-encore-version 1.38))
|
(encore/assert-min-encore-version 2.16))
|
||||||
|
|
||||||
;;;; Nippy data format
|
;;;; Nippy data format
|
||||||
;; * 4-byte header (Nippy v2.x+) (may be disabled but incl. by default) [1].
|
;; * 4-byte header (Nippy v2.x+) (may be disabled but incl. by default) [1].
|
||||||
|
|
@ -202,7 +202,7 @@
|
||||||
(println (format "DEBUG - freezer-coll: %s for %s" ~type (type ~'x)))))
|
(println (format "DEBUG - freezer-coll: %s for %s" ~type (type ~'x)))))
|
||||||
(if (counted? ~'x)
|
(if (counted? ~'x)
|
||||||
(do (.writeInt ~'out (count ~'x))
|
(do (.writeInt ~'out (count ~'x))
|
||||||
(encore/backport-run! (fn [i#] (freeze-to-out ~'out i#)) ~'x))
|
(encore/run!* (fn [i#] (freeze-to-out ~'out i#)) ~'x))
|
||||||
(let [bas# (ByteArrayOutputStream.)
|
(let [bas# (ByteArrayOutputStream.)
|
||||||
sout# (DataOutputStream. bas#)
|
sout# (DataOutputStream. bas#)
|
||||||
cnt# (reduce (fn [^long cnt# i#]
|
cnt# (reduce (fn [^long cnt# i#]
|
||||||
|
|
@ -216,8 +216,8 @@
|
||||||
(defmacro ^:private freezer-kvs [type id & body]
|
(defmacro ^:private freezer-kvs [type id & body]
|
||||||
`(freezer ~type ~id
|
`(freezer ~type ~id
|
||||||
(.writeInt ~'out (* 2 (count ~'x))) ; *2 here is vestigial
|
(.writeInt ~'out (* 2 (count ~'x))) ; *2 here is vestigial
|
||||||
(encore/backport-run!
|
(encore/run-kv!
|
||||||
(fn [[k# v#]]
|
(fn [k# v#]
|
||||||
(freeze-to-out ~'out k#)
|
(freeze-to-out ~'out k#)
|
||||||
(freeze-to-out ~'out v#))
|
(freeze-to-out ~'out v#))
|
||||||
~'x)))
|
~'x)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue