-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Description
Clojure compiles (let [cls String] (instance? klass "a")) less optimally than (instance? String "a"). This affects this line, which I imagine is a pretty hot code path in schema usage:
schema/src/cljc/schema/core.cljc
Line 166 in 8fcb57f
| #?(:clj #(instance? klass %) |
The perf difference seems roughly 2x.
examples.server=> (time (dotimes [_ 10000] (let [cls String] (instance? cls "a"))))
"Elapsed time: 1.142388 msecs"
nil
examples.server=> (time (dotimes [_ 10000] (instance? String "a")))
"Elapsed time: 0.411797 msecs"
nilMetadata
Metadata
Assignees
Labels
No labels