Fork me on GitHub

@yogthos sure will! with this pace, pushing out feature per week, should be stable by end of year. I want to support both clj & cljs right from start, so need to port the ring-swagger for cljc too. Als, reitit-http will be pedestal/interceptors, reitit-ring ring/middleware. I guess Luminus stays with the Ring-stack? Both modules will have the same features.


this actually opens up the possibility of adding a pedestal profile in luminus


One thing we chatted earlier was ability to make the middleware chains lazy: one could modify the chain at runtime (like the interceptor queueing). Here are some benchmarks, executing a chain of 10 no-op middleware / interceptor:

; Middleware (static chain) => 5µs
; Middleware (dynamic chain) => 60µs

; Interceptor (static queue) => 20µs
; Interceptor (context queues) => 30µs
; Pedestal (context queues) => 79µs


By default, the middleware chain is really fast, smal functions to the stack. Its an order of magnitude faster than pedestal chain (all logging turned off).


making the middleware chain modifiable at runtime makes it x10 slower. And in my test there was no initialization, if there would be mw argument parsing etc. it would be even slower.


Did few tests on how to create a fast interceptor runner, simplests runners (written in java) could be something like x3 slower than the mw-version. To support generic async (manifold, core.async, promesa) has some impact.


but: the mw-chain is always the fastest, interceptor-chain is more handy with async.


Trying to get the Pedestal people interested in creating a “Interceptor Spec” (like the Ring spec is today) that could be used with different interceptor libs. Currently, many version of the original, bit different and thus incompatible.


oh, that was 100-long chain. not from real life with chain of 10:

; Middleware (map, static chain)     =>  960ns
; Middleware (record, static chain)  =>  380ns
; Middleware (dynamic chain)         => 6600ns

; Interceptor (static queue)         => 2000ns
; Interceptor (context queues)       => 3000ns
; Pedestal (context queues)          => 8800ns



(defn middleware [handler value]
  (fn [request]
    (let [values (or (:values request) [])]
      (handler (assoc request :values (conj values value))))))


interceptor (before IntoInterceptor):

(defn interceptor [value]
  (fn [context]
    (let [values (or (:values context) [])]
      (assoc context :values (conj values value)))))