Cleanup & fix perf test

This commit is contained in:
Tommi Reiman 2017-08-12 17:55:58 +03:00
parent 1835ffc681
commit 5f1d6a61a6
4 changed files with 4 additions and 5 deletions

View file

@ -93,7 +93,7 @@
;; 2.4µs (-84%) ;; 2.4µs (-84%)
(title "pedestal - map-tree => prefix-tree") (title "pedestal - map-tree => prefix-tree")
(let [call #(pedestal/find-route pedestal-routes {:path-info "/workspace/1/1" :request-method :get})] (let [call #(pedestal/find-route pedestal-router {:path-info "/workspace/1/1" :request-method :get})]
(assert (call)) (assert (call))
(cc/quick-bench (cc/quick-bench
(call))) (call)))

View file

@ -90,7 +90,7 @@
"Creates a [[LinearRouter]] from routes and optional options. "Creates a [[LinearRouter]] from routes and optional options.
See [[router]] for available options" See [[router]] for available options"
([routes] ([routes]
(linear-router routes {})) (linear-router routes {}))
([routes {:keys [compile]}] ([routes {:keys [compile]}]
(let [compiled (map (partial compile-route compile) routes)] (let [compiled (map (partial compile-route compile) routes)]
(->LinearRouter (->LinearRouter
@ -118,7 +118,7 @@
"Creates a [[LookupRouter]] from routes and optional options. "Creates a [[LookupRouter]] from routes and optional options.
See [[router]] for available options" See [[router]] for available options"
([routes] ([routes]
(lookup-router routes {})) (lookup-router routes {}))
([routes {:keys [compile]}] ([routes {:keys [compile]}]
(let [compiled (map (partial compile-route compile) routes)] (let [compiled (map (partial compile-route compile) routes)]
(when-let [route (some impl/contains-wilds? (map first routes))] (when-let [route (some impl/contains-wilds? (map first routes))]

View file

@ -10,7 +10,7 @@
; ;
; You must not remove this notice, or any other, from this software. ; You must not remove this notice, or any other, from this software.
(ns reitit.impl (ns ^:no-doc reitit.impl
(:require [clojure.string :as str] (:require [clojure.string :as str]
[clojure.set :as set]) [clojure.set :as set])
(:import #?(:clj (java.util.regex Pattern)))) (:import #?(:clj (java.util.regex Pattern))))

View file

@ -119,4 +119,3 @@
:path "/api/user/1/2" :path "/api/user/1/2"
:params {:id "1", :sub-id "2"}}) :params {:id "1", :sub-id "2"}})
(reitit/match-by-path router "/api/user/1/2")))))) (reitit/match-by-path router "/api/user/1/2"))))))