Open ikitommi opened 5 years ago
Using protocols instead of Context records/maps would allow a) much faster dispatching and b) sieppari to be used with plain objects (with static queues) too:
(let [interceptors (mapv interceptor [{:enter inc :leave inc} {:enter (partial * 2) :leave (partial * 2)} {:enter inc}])] ;; 100ns (cc/quick-bench (run (queue interceptors) 0))) (let [app (comp inc (partial * 2) inc (partial * 2) inc)] ;; 88ns (cc/quick-bench (app 0)))
Using protocols instead of Context records/maps would allow a) much faster dispatching and b) sieppari to be used with plain objects (with static queues) too: