From 61783e4c81587d4887a9b3fb55c340bfa2de521d Mon Sep 17 00:00:00 2001 From: Ben Sless Date: Sun, 25 Aug 2024 18:56:30 +0300 Subject: [PATCH] Statically def transducer Eliminates allocation and friendlier to JIT --- modules/reitit-core/src/reitit/walk.clj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/reitit-core/src/reitit/walk.clj b/modules/reitit-core/src/reitit/walk.clj index 2def25d8..132153ab 100644 --- a/modules/reitit-core/src/reitit/walk.clj +++ b/modules/reitit-core/src/reitit/walk.clj @@ -11,9 +11,11 @@ [m] (persistent! (reduce-kv keywordize-kv (transient (empty m)) m))) +(def ^:private keywordize-xf (map -keywordize)) + (defn- -keywordize-default [coll] - (into (empty coll) (map -keywordize) coll)) + (into (empty coll) keywordize-xf coll)) (doseq [type [clojure.lang.PersistentHashSet clojure.lang.PersistentVector