From 16116d3e5869209bc14d4135b491a7e572bdf05a Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sun, 5 Nov 2017 19:33:36 +0200 Subject: [PATCH] quickbenck over rest-routes --- .../clj/reitit/opensensors_routing_test.clj | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/perf-test/clj/reitit/opensensors_routing_test.clj b/perf-test/clj/reitit/opensensors_routing_test.clj index 9017ac9c..83041fbf 100644 --- a/perf-test/clj/reitit/opensensors_routing_test.clj +++ b/perf-test/clj/reitit/opensensors_routing_test.clj @@ -73,19 +73,11 @@ total 10000 dropped (int (* total 0.45))] (mapv - #(let [times (->> (range total) - (mapv - (fn [_] - (let [now (System/nanoTime) - result (f %) - total (- (System/nanoTime) now)] - (assert result) - total))) - (sort) - (drop dropped) - (drop-last dropped)) - avg (int (/ (reduce + times) (count times)))] - [% avg]) urls))) + (fn [path] + (let [time (int (* (first (:sample-mean (cc/quick-benchmark (dotimes [_ 1000] (f path)) {}))) 1e6))] + (println path "=>" time "ns") + [path time])) + urls))) (defn bench [routes no-paths?] (let [routes (mapv (fn [[path name]]