> I imagine this is possible if you drill into the guts of > PersistentHaspMap, but I would strongly discourage the behavior in > user code. Perhaps as an upgrade to the object itself? There is a 1% > chance that this could be a language upgrade, assuming it works across > the board. I would tread cautiously.
I could easily imagine an implementation of equality for two tree sets checking for intermediate node reference equality as a shortcut... but as you say, not in user code. Right now, APersistentSet.equals(Object o) only casts to Set, and does equality checking by iterating over the elements of the input set. I'd certainly benchmark this before doing the work, though -- I'd guess that most equal sets will hash-compare as equal, most non-equal sets will fail early on in a per-element comparison, and it's probably a minority of compared sets that will share structure. It's unlikely that adding an additional object identity comparison is worth the machine instructions. My hunch (from examining the performance of Clojure's sets in the past) is that it's not worth doing the work... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
