Fork me on GitHub
#clojure-dev
<
2024-02-06
>
souenzzo13:02:14

It is a know issue that inst? (that uses satisfies? ) can be more than 2000x slower than a simple predicate?

(doseq [f [inst? string? any?]]
  (prn f)
  (dotimes [_ 3]
    (time (dotimes [_ 1e5]
            (f [])))))
;; inst?: ~2000 msecs
;; string? ~0.5 msecs
;; any? ~0.5 msecs
It is slow for some values like :x, and even slower for other values like []

Alex Miller (Clojure team)13:02:54

It is a known issue that satisfies? can be slow

Alex Miller (Clojure team)13:02:51

Particularly on non satisfying values

souenzzo13:02:54

Do you have a ticket for that? It can be a closed one, I just want some reference to this issue

Noah Bogart14:02:10

(has the jira ticket linked)

Yehonathan Sharvit14:02:41

Is there a workaround for re-implementing inst? in an efficient way?