Add autobench to tests

This commit is contained in:
Peter Taoussanis 2013-01-20 19:37:08 +07:00
parent f056abc0e8
commit fdff6aacd1
2 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -1,6 +1,7 @@
(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))
@ -8,3 +9,9 @@
(def roundtrip (comp nippy/thaw-from-bytes nippy/freeze-to-bytes))
(deftest test-roundtrip (is (= test-data (roundtrip test-data))))
(println "Benchmarking roundtrips (x3)")
(println "----------------------------")
(println (benchmarks/autobench))
(println (benchmarks/autobench))
(println (benchmarks/autobench))