Switch to encore v1.28.0, doseq->backport-run! (better perf)
This commit is contained in:
parent
23d4d78a77
commit
7753eefd2e
2 changed files with 13 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
(defproject com.taoensso/nippy "2.9.0-RC1"
|
(defproject com.taoensso/nippy "2.9.0-RC2"
|
||||||
:author "Peter Taoussanis <https://www.taoensso.com>"
|
:author "Peter Taoussanis <https://www.taoensso.com>"
|
||||||
:description "Clojure serialization library"
|
:description "Clojure serialization library"
|
||||||
:url "https://github.com/ptaoussanis/nippy"
|
:url "https://github.com/ptaoussanis/nippy"
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
:dependencies
|
:dependencies
|
||||||
[[org.clojure/clojure "1.4.0"]
|
[[org.clojure/clojure "1.4.0"]
|
||||||
[org.clojure/tools.reader "0.9.2"]
|
[org.clojure/tools.reader "0.9.2"]
|
||||||
[com.taoensso/encore "1.24.1"]
|
[com.taoensso/encore "1.28.0"]
|
||||||
[org.iq80.snappy/snappy "0.3"]
|
[org.iq80.snappy/snappy "0.3"]
|
||||||
[org.tukaani/xz "1.5"]
|
[org.tukaani/xz "1.5"]
|
||||||
[net.jpountz.lz4/lz4 "1.3"]]
|
[net.jpountz.lz4/lz4 "1.3"]]
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
;;;; Encore version check
|
;;;; Encore version check
|
||||||
|
|
||||||
(let [min-encore-version 1.21]
|
(let [min-encore-version 1.28] ; For `backport-run!` support
|
||||||
(if-let [assert! (ns-resolve 'taoensso.encore 'assert-min-encore-version)]
|
(if-let [assert! (ns-resolve 'taoensso.encore 'assert-min-encore-version)]
|
||||||
(assert! min-encore-version)
|
(assert! min-encore-version)
|
||||||
(throw
|
(throw
|
||||||
|
|
@ -209,7 +209,8 @@
|
||||||
(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))
|
||||||
(doseq [i# ~'x] (freeze-to-out ~'out i#)))
|
;; (doseq [i# ~'x] (freeze-to-out ~'out i#))
|
||||||
|
(encore/backport-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#]
|
||||||
|
|
@ -223,9 +224,14 @@
|
||||||
(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)))
|
(.writeInt ~'out (* 2 (count ~'x)))
|
||||||
(doseq [kv# ~'x]
|
;; (doseq [kv# ~'x]
|
||||||
|
;; (freeze-to-out ~'out (key kv#))
|
||||||
|
;; (freeze-to-out ~'out (val kv#)))
|
||||||
|
(encore/backport-run!
|
||||||
|
(fn [kv#]
|
||||||
(freeze-to-out ~'out (key kv#))
|
(freeze-to-out ~'out (key kv#))
|
||||||
(freeze-to-out ~'out (val kv#)))))
|
(freeze-to-out ~'out (val kv#)))
|
||||||
|
~'x)))
|
||||||
|
|
||||||
(freezer (Class/forName "[B") id-bytes (write-bytes out ^bytes x))
|
(freezer (Class/forName "[B") id-bytes (write-bytes out ^bytes x))
|
||||||
(freezer nil id-nil)
|
(freezer nil id-nil)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue