SNAPSHOT to avoid reflection

This commit is contained in:
Tommi Reiman 2019-01-29 07:27:45 +02:00
parent 08edbe5b01
commit 94f4ab4e75
2 changed files with 86 additions and 78 deletions

View file

@ -14,7 +14,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]
[reitit.core :as r])) [reitit.core :as r]
[criterium.core :as cc]))
;; ;;
;; start repl with `lein perf repl` ;; start repl with `lein perf repl`
@ -621,12 +622,19 @@
(comment (comment
;; 629ms (arraylist) ;; 629ms (arraylist)
;; 395ns (transient) ;; 395ns (transient)
(let [app (ring/ring-handler (ring/router opensensors-routes))] ;; (staticMultiMatcher)
(let [app (ring/ring-handler (ring/router opensensors-routes) {:inject-match? false, :inject-router? false})
request {:uri "/v1/users/1/devices/1", :request-method :get}]
(doseq [[p r] (-> app (ring/get-router) (r/routes))] (doseq [[p r] (-> app (ring/get-router) (r/routes))]
(when-not (app {:uri p, :request-method :get}) (when-not (app {:uri p, :request-method :get})
(println "FAIL:" p))) (println "FAIL:" p)))
(println (app {:uri "/v1/users/1/devices/1", :request-method :get})) (println (app request))
(prof/start {}) (cc/quick-bench
(dotimes [_ 100000] (app request))
(app {:uri "/v1/users/1/devices/1", :request-method :get})) #_#_#_(prof/start {})
; "Elapsed time: 9183.657012 msecs"
; "Elapsed time: 8674.70132 msecs"
(time
(dotimes [_ 20000000]
(app request)))
(str (prof/stop {})))) (str (prof/stop {}))))

View file

@ -91,7 +91,7 @@
[manifold "0.1.8"] [manifold "0.1.8"]
[funcool/promesa "1.9.0"] [funcool/promesa "1.9.0"]
[com.clojure-goes-fast/clj-async-profiler "0.2.2"] [com.clojure-goes-fast/clj-async-profiler "0.2.3-SNAPSHOT"]
;; https://github.com/bensu/doo/issues/180 ;; https://github.com/bensu/doo/issues/180
[fipp "0.6.14" :exclusions [org.clojure/core.rrb-vector]]]} [fipp "0.6.14" :exclusions [org.clojure/core.rrb-vector]]]}