Fork me on GitHub
#reitit
<
2019-04-22
>
ikitommi10:04:44

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

ikitommi12:04:04

Toyed with the sieppari.next 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.

ikitommi12:04:03

… 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.

ikitommi12:04:43

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)))