clojure-dev

souenzzo 2024-02-06T13:36:14.947199Z

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) 2024-02-06T13:39:54.015349Z

It is a known issue that satisfies? can be slow

Alex Miller (Clojure team) 2024-02-06T13:42:51.094769Z

Particularly on non satisfying values

souenzzo 2024-02-06T13:53:54.434439Z

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

2024-02-06T14:25:10.828429Z

(has the jira ticket linked)

Yehonathan Sharvit 2024-02-06T14:46:41.251139Z

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