mirror of
https://github.com/metosin/reitit.git
synced 2026-02-24 02:32:22 +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
|
||||
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]]
|
||||
|
|
|
|||
Loading…
Reference in a new issue