diff options
| author | Rich Hickey <richhickey@gmail.com> | 2009-11-15 12:37:32 -0500 |
|---|---|---|
| committer | Rich Hickey <richhickey@gmail.com> | 2009-11-15 12:37:32 -0500 |
| commit | ecd7161bf4397f04385fdaf9e5c6168580676ffa (patch) | |
| tree | f10c8901e09939e522445d06bd36d797683d3521 /src/clj | |
| parent | a64704a9f163ed7271e527587c4d27073c25fc48 (diff) | |
perf tweaks
Diffstat (limited to 'src/clj')
| -rw-r--r-- | src/clj/clojure/core_deftype.clj | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/clj/clojure/core_deftype.clj b/src/clj/clojure/core_deftype.clj index 58827784..3d77ad47 100644 --- a/src/clj/clojure/core_deftype.clj +++ b/src/clj/clojure/core_deftype.clj @@ -260,11 +260,13 @@ `(if (instance? ~on-interface ~target) (. ~(with-meta target {:tag on-interface}) ~(or on-method method) ~@(rest gargs))) `(do)) - (let [cache# (.__methodImplCache ~gthis) - c# (class ~target) - f# (or (.fnFor cache# c#) - (-cache-protocol-fn ~gthis ~target))] - (f# ~@gargs)))))) + (let [cache# (.__methodImplCache ~gthis)] + (if (clojure.lang.Util/identical (clojure.lang.Util/classOf ~target) + (.lastClass cache#)) + ((.lastImpl cache#) ~@gargs) + (let [f# (or (.fnFor cache# (clojure.lang.Util/classOf ~target)) + (-cache-protocol-fn ~gthis ~target))] + (f# ~@gargs)))))))) arglists))] (set! (.__methodImplCache f#) cache#) f#)))) @@ -287,7 +289,7 @@ (defn- emit-protocol [name opts+sigs] (let [[opts sigs] - (loop [opts {} sigs opts+sigs] + (loop [opts {:on nil} sigs opts+sigs] (condp #(%1 %2) (first sigs) string? (recur (assoc opts :doc (first sigs)) (next sigs)) keyword? (recur (assoc opts (first sigs) (second sigs)) (nnext sigs)) |
