mirror of
https://github.com/metosin/reitit.git
synced 2026-02-13 23:05:16 +00:00
measure ring-handler perf
This commit is contained in:
parent
d433005df6
commit
5b928d0873
1 changed files with 22 additions and 1 deletions
|
|
@ -10,7 +10,8 @@
|
||||||
[io.pedestal.http.route.definition.table :as table]
|
[io.pedestal.http.route.definition.table :as table]
|
||||||
[io.pedestal.http.route.map-tree :as map-tree]
|
[io.pedestal.http.route.map-tree :as map-tree]
|
||||||
[io.pedestal.http.route.router :as pedestal]
|
[io.pedestal.http.route.router :as pedestal]
|
||||||
[io.pedestal.http.route :as route]))
|
[io.pedestal.http.route :as route]
|
||||||
|
[reitit.ring :as ring]))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; start repl with `lein perf repl`
|
;; start repl with `lein perf repl`
|
||||||
|
|
@ -62,6 +63,26 @@
|
||||||
["/auth/recovery/token/:token" :auth/recovery]
|
["/auth/recovery/token/:token" :auth/recovery]
|
||||||
["/workspace/:project/:page" :workspace/page]]))
|
["/workspace/:project/:page" :workspace/page]]))
|
||||||
|
|
||||||
|
(def ring-app
|
||||||
|
(ring/ring-handler
|
||||||
|
(ring/router
|
||||||
|
[["/auth/login" {:get identity}]
|
||||||
|
["/auth/recovery/token/:token" {:get identity}]
|
||||||
|
["/workspace/:project/:page" {:get identity}]])))
|
||||||
|
|
||||||
|
(comment
|
||||||
|
|
||||||
|
(ring-app {:request-method :get, :uri "/auth/login"})
|
||||||
|
|
||||||
|
;; 213ns
|
||||||
|
;; 204ns (remove if)
|
||||||
|
;; 163ns (inline fast-assoc)
|
||||||
|
;; 156ns (don't inline fast-assoc)
|
||||||
|
;; 128ns (single method dispatch)
|
||||||
|
;; 80ns --> (don't inject router & match)
|
||||||
|
(cc/quick-bench
|
||||||
|
(ring-app {:request-method :post, :uri "/auth/login"})))
|
||||||
|
|
||||||
(defn routing-test1 []
|
(defn routing-test1 []
|
||||||
|
|
||||||
(suite "static route")
|
(suite "static route")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue