Fork me on GitHub
#clojure-dev
<
2021-09-30
>
Ben Sless09:09:07

I just realized the structural equality semantics could be sped up significantly if equiv() is implemented for the non-abstract types. There are happier paths the code could take: • When comparing vectors, nth is called for every element (worst case), but nth always calls arrayFor which isn't reused • When comparing maps, the map casts itself to a sequence first These cases can go through reduce and reduce-kv respectively and give dramatically different results. Should I open a ask.clojure issue for it?

👍 1
Ben Sless17:09:43

^ This makes small collections viable as keys in maps

ghadi16:10:33

responded

serioga14:10:57

@UK0810AQ2 I would check the size of counted collections to completely avoid iteration over them if size is different.

Ben Sless14:10:21

@U0HJNJWJH that's a common feature of all implementations of equiv I skipped over, rationale detailed in the discussion