 
 (defrecord RequestOrContext [values queue stack])
 
-(def +items+ 100)
+(def +items+ 10)
 
 (defn expected! [x]
   (assert (= (range +items+) (:values x))))

                       {:enter (interceptor value)}) (range +items+)))
        ctx (io.pedestal.interceptor.chain/enqueue nil is)]

    ;; 78 µs
    (title "pedestal")
    (cc/quick-bench
      (io.pedestal.interceptor.chain/execute ctx))))

(defn pedestal-tuned-chain-text []
  (let [is (map io.pedestal.interceptor/interceptor
                (map (fn [value]
                       {:enter (interceptor value)}) (range +items+)))
        ctx (reitit.chain/map->Context (reitit.chain/enqueue nil is))]

    ;; 67 µs
    (title "pedestal - tuned")
    (cc/quick-bench
      (reitit.chain/execute ctx))))

;;
;; Naive chain


(defn interceptor-test []
  (let [interceptors (map (fn [value] [interceptor value]) (range +items+))
        app (executor-reduce (interceptor/chain interceptors identity {}))
        map-request {}
        record-request (map->RequestOrContext map-request)]

    ;; 1900ns
    (title "interceptors - map")
    (expected! (app map-request))
    (cc/quick-bench
      (app map-request))

    ;; 1300ns
    (title "interceptors - record")
    (expected! (app record-request))
    (cc/quick-bench
