Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add universal reducer function as a default reducer.

  • Loading branch information...
commit 8a59a1ae86e228b2e6ea729b10b58f9aeae2da92 1 parent 6208b26
@davidsantiago davidsantiago authored committed
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/criterium/core.clj
View
9 src/criterium/core.clj
@@ -492,6 +492,13 @@ See http://www.ellipticgroup.com/misc/article_supplement.pdf, p17."
%1)
options)))))
+(defn default-reducer
+ "A function that can be used to reduce any function output."
+ [a b]
+ (let [a (if (nil? a) 0 (.hashCode a))
+ b (if (nil? b) 0 (.hashCode b))]
+ (+ a b)))
+
;;; User top level functions
(defmacro with-progress-reporting
"Macro to enable progress reporting during the benchmark."
@@ -510,7 +517,7 @@ See http://www.ellipticgroup.com/misc/article_supplement.pdf, p17."
(:warmup-jit-period opts)
(:target-execution-time opts)
f
- (:reduce-with opts))
+ (:reduce-with opts default-reducer))
outliers (outliers (:samples times))
ci (/ (:confidence-interval opts) 2)
stats (bootstrap-bca
Please sign in to comment.
Something went wrong with that request. Please try again.