Fork me on GitHub

I heard could they could take some time. There is #clojure-north where the organizers hang out


Toyed with the interceptor runner. Looks like we can make the interceptor execution really fast too. Not as fast as a threaded function chain, but already faster than with chain composed with comp. Also, much more powerful than just 1-way function chains.


… and the middleware chain is composed using comp, so in theory, the interceptor chain can be made faster. But at least there will not be a big difference, which is kinda awesome.


simplified test

(let [functions [inc (partial * 2) inc (partial * 2) inc]
      interceptors (s/chain functions)
      composed (apply comp functions)]
  (= 7 (interceptors 0) (composed 0))
  ;; 73ns
  (cc/quick-bench (interceptors 0))
  ;; 85ns
  (cc/quick-bench (composed 0)))