diff --git a/benchmarks/benchmarks.clj b/src/taoensso/nippy/benchmarks.clj similarity index 97% rename from benchmarks/benchmarks.clj rename to src/taoensso/nippy/benchmarks.clj index 4f56786..eeed80a 100644 --- a/benchmarks/benchmarks.clj +++ b/src/taoensso/nippy/benchmarks.clj @@ -14,6 +14,8 @@ (def roundtrip (comp thaw-from-bytes freeze-to-bytes)) (def reader-roundtrip (comp reader-thaw reader-freeze)) +(defn autobench [] (bench (roundtrip data))) + (comment ;;; Times diff --git a/test/test_nippy/main.clj b/test/test_nippy/main.clj index ec4e41a..bec0e6a 100644 --- a/test/test_nippy/main.clj +++ b/test/test_nippy/main.clj @@ -1,10 +1,17 @@ (ns test-nippy.main (: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 (def test-data (dissoc nippy/stress-data :bytes)) (def roundtrip (comp nippy/thaw-from-bytes nippy/freeze-to-bytes)) -(deftest test-roundtrip (is (= test-data (roundtrip test-data)))) \ No newline at end of file +(deftest test-roundtrip (is (= test-data (roundtrip test-data)))) + +(println "Benchmarking roundtrips (x3)") +(println "----------------------------") +(println (benchmarks/autobench)) +(println (benchmarks/autobench)) +(println (benchmarks/autobench))