test all calfpath perf

This commit is contained in:
Tommi Reiman 2019-01-14 20:41:58 +02:00
parent 4c722d628e
commit 9e58f93cc9
2 changed files with 16 additions and 5 deletions

View file

@ -489,9 +489,12 @@
{:uri "/v1/users/:user-id/bookmarks" :nested [{:method :get, :handler handler}]}
{:uri "/v1/orgs/:org-id/topics" :nested [{:method :get, :handler handler}]}])
(def opensensors-calfpath-data-handler
(def opensensors-calfpath-walker-handler
(partial cr/dispatch (cr/compile-routes opensensors-calfpath-routes {:show-uris-400? false})))
(def opensensors-calfpath-unroll-handler
(cr/make-dispatcher (cr/compile-routes opensensors-calfpath-routes {:show-uris-400? false})))
(comment
(pedestal/find-route
(map-tree/router
@ -551,7 +554,8 @@
reitit-ring-fast-f (ring/ring-handler (ring/router opensensors-routes) nil {:inject-router? false, :inject-match? false})
bidi-f #(bidi/match-route opensensors-bidi-routes (:uri %))
calfpath-macros-f opensensors-calfpath-macro-handler
calfpath-data-f opensensors-calfpath-data-handler
calfpath-walker-f opensensors-calfpath-walker-handler
calfpath-unroll-f opensensors-calfpath-unroll-handler
ataraxy-f (partial ataraxy/matches opensensors-ataraxy-routes)
compojure-f opensensors-compojure-routes
pedestal-f (partial pedestal/find-route opensensors-pedestal-routes)
@ -577,13 +581,16 @@
;; 385ns (java-segment-router, no injects)
(b! "reitit-ring-fast" reitit-ring-fast-f)
;; 2258ns
(b! "calfpath-data" calfpath-data-f)
;; 2137ns
(b! "calfpath-walker" calfpath-walker-f)
;; 4774ns
(b! "calfpath-unroll" calfpath-unroll-f)
;; 2821ns
(b! "pedestal" pedestal-f)
;; 4364ns
;; 4803ns
(b! "calfpath-macros" calfpath-macros-f)
;; 11615ns

View file

@ -17,6 +17,8 @@
(is (= [["/api/ipa/:size" {:name ::beer}]]
(r/routes router)))
(is (map? (r/options router)))
(is (= nil
(r/match-by-path router "/api")))
(is (= (r/map->Match
{:template "/api/ipa/:size"
:data {:name ::beer}
@ -108,6 +110,8 @@
(is (= [["/api/ipa/large" {:name ::beer}]]
(r/routes router)))
(is (map? (r/options router)))
(is (= nil
(r/match-by-path router "/api")))
(is (= (r/map->Match
{:template "/api/ipa/large"
:data {:name ::beer}