Add autobench to tests
This commit is contained in:
parent
f056abc0e8
commit
fdff6aacd1
2 changed files with 11 additions and 2 deletions
|
|
@ -14,6 +14,8 @@
|
||||||
(def roundtrip (comp thaw-from-bytes freeze-to-bytes))
|
(def roundtrip (comp thaw-from-bytes freeze-to-bytes))
|
||||||
(def reader-roundtrip (comp reader-thaw reader-freeze))
|
(def reader-roundtrip (comp reader-thaw reader-freeze))
|
||||||
|
|
||||||
|
(defn autobench [] (bench (roundtrip data)))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
|
|
||||||
;;; Times
|
;;; Times
|
||||||
|
|
@ -1,10 +1,17 @@
|
||||||
(ns test-nippy.main
|
(ns test-nippy.main
|
||||||
(:use [clojure.test])
|
(:use [clojure.test])
|
||||||
(:require [taoensso.nippy :as nippy]))
|
(:require [taoensso.nippy :as nippy]
|
||||||
|
[taoensso.nippy.benchmarks :as benchmarks]))
|
||||||
|
|
||||||
;; Remove stuff from stress-data that breaks roundtrip equality
|
;; Remove stuff from stress-data that breaks roundtrip equality
|
||||||
(def test-data (dissoc nippy/stress-data :bytes))
|
(def test-data (dissoc nippy/stress-data :bytes))
|
||||||
|
|
||||||
(def roundtrip (comp nippy/thaw-from-bytes nippy/freeze-to-bytes))
|
(def roundtrip (comp nippy/thaw-from-bytes nippy/freeze-to-bytes))
|
||||||
|
|
||||||
(deftest test-roundtrip (is (= test-data (roundtrip test-data))))
|
(deftest test-roundtrip (is (= test-data (roundtrip test-data))))
|
||||||
|
|
||||||
|
(println "Benchmarking roundtrips (x3)")
|
||||||
|
(println "----------------------------")
|
||||||
|
(println (benchmarks/autobench))
|
||||||
|
(println (benchmarks/autobench))
|
||||||
|
(println (benchmarks/autobench))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue