From 42950ec24a6653f57c2deda3cfd97e3077ee3e07 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Tue, 21 Jan 2014 14:33:35 +0700 Subject: [PATCH] Add `stress-data-comparable`, `stress-data-benchable` --- src/taoensso/nippy.clj | 9 +++++++++ src/taoensso/nippy/benchmarks.clj | 3 +-- test/taoensso/nippy/tests/main.clj | 4 +--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/taoensso/nippy.clj b/src/taoensso/nippy.clj index bd7f330..aa30e77 100644 --- a/src/taoensso/nippy.clj +++ b/src/taoensso/nippy.clj @@ -567,6 +567,15 @@ :exception (try (/ 1 0) (catch Exception e e)) :ex-info (ex-info "ExInfo" {:data "data"})})) +(def stress-data-comparable + "Reference data with stuff removed that breaks roundtrip equality." + (dissoc stress-data :bytes :throwable :exception :ex-info)) + +(def stress-data-benchable + "Reference data with stuff removed that breaks reader or other utils we'll + be benching against." + (dissoc stress-data :bytes :throwable :exception :ex-info :queue :queue-empty)) + ;;;; Data recovery/analysis (defn inspect-ba "Alpha - subject to change." diff --git a/src/taoensso/nippy/benchmarks.clj b/src/taoensso/nippy/benchmarks.clj index 0e7946f..9934768 100644 --- a/src/taoensso/nippy/benchmarks.clj +++ b/src/taoensso/nippy/benchmarks.clj @@ -5,8 +5,7 @@ [taoensso.nippy.compression :as compression] [taoensso.nippy.utils :as utils])) -;; Remove stuff from stress-data that breaks reader -(def data (dissoc nippy/stress-data :queue :queue-empty :bytes)) +(def data nippy/stress-data-benchable) (defmacro bench* [& body] `(utils/bench 10000 {:warmup-laps 20000} ~@body)) (defn bench1 [freezer thawer & [sizer]] diff --git a/test/taoensso/nippy/tests/main.clj b/test/taoensso/nippy/tests/main.clj index 8435112..629190f 100644 --- a/test/taoensso/nippy/tests/main.clj +++ b/test/taoensso/nippy/tests/main.clj @@ -4,9 +4,7 @@ [taoensso.nippy.compression :as compression] [taoensso.nippy.benchmarks :as benchmarks])) -;; Remove stuff from stress-data that breaks roundtrip equality -(def test-data (dissoc nippy/stress-data :bytes :throwable :exception :ex-info)) - +(def test-data nippy/stress-data-comparable) (defn- before-run {:expectations-options :before-run} []) (defn- after-run {:expectations-options :after-run} [])