fix perf tests

This commit is contained in:
Tommi Reiman 2019-02-28 10:19:21 +02:00
parent 3aae55bd8c
commit a9c33de7d1

View file

@ -70,11 +70,12 @@
nil routes)) nil routes))
(def trie-matcher (def trie-matcher
(trie/compile (trie/matcher
(reduce (trie/compile
(fn [acc [p d]] (reduce
(trie/insert acc p d)) (fn [acc [p d]]
nil routes))) (trie/insert acc p d))
nil routes))))
(defn bench! [] (defn bench! []
@ -108,13 +109,13 @@
;; 0.51µs (Cleanup) ;; 0.51µs (Cleanup)
;; 0.30µs (Java) ;; 0.30µs (Java)
#_(cc/quick-bench #_(cc/quick-bench
(segment/lookup segment-matcher "/v1/orgs/1/topics")) (segment/lookup segment-matcher "/v1/orgs/1/topics"))
;; 0.32µs (initial) ;; 0.32µs (initial)
;; 0.30µs (iterate arrays) ;; 0.30µs (iterate arrays)
;; 0.28µs (list-params) ;; 0.28µs (list-params)
(cc/quick-bench (cc/quick-bench
(trie/matcher trie-matcher "/v1/orgs/1/topics"))) (trie-matcher "/v1/orgs/1/topics")))
(comment (comment
(bench!)) (bench!))
@ -123,6 +124,6 @@
(comment (comment
(p/lookup pedestal-tree "/v1/orgs/1/topics") (p/lookup pedestal-tree "/v1/orgs/1/topics")
(trie/matcher trie-matcher "/v1/orgs/1/topics") (trie-matcher "/v1/orgs/1/topics")
#_(segment/lookup segment-matcher "/v1/orgs/1/topics")) #_(segment/lookup segment-matcher "/v1/orgs/1/topics"))