mirror of
https://github.com/metosin/reitit.git
synced 2026-02-13 06:45:16 +00:00
quickbenck over rest-routes
This commit is contained in:
parent
4163c7c367
commit
16116d3e58
1 changed files with 5 additions and 13 deletions
|
|
@ -73,19 +73,11 @@
|
||||||
total 10000
|
total 10000
|
||||||
dropped (int (* total 0.45))]
|
dropped (int (* total 0.45))]
|
||||||
(mapv
|
(mapv
|
||||||
#(let [times (->> (range total)
|
(fn [path]
|
||||||
(mapv
|
(let [time (int (* (first (:sample-mean (cc/quick-benchmark (dotimes [_ 1000] (f path)) {}))) 1e6))]
|
||||||
(fn [_]
|
(println path "=>" time "ns")
|
||||||
(let [now (System/nanoTime)
|
[path time]))
|
||||||
result (f %)
|
urls)))
|
||||||
total (- (System/nanoTime) now)]
|
|
||||||
(assert result)
|
|
||||||
total)))
|
|
||||||
(sort)
|
|
||||||
(drop dropped)
|
|
||||||
(drop-last dropped))
|
|
||||||
avg (int (/ (reduce + times) (count times)))]
|
|
||||||
[% avg]) urls)))
|
|
||||||
|
|
||||||
(defn bench [routes no-paths?]
|
(defn bench [routes no-paths?]
|
||||||
(let [routes (mapv (fn [[path name]]
|
(let [routes (mapv (fn [[path name]]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue