Efficient comparision of large data structures

No, equality checks on long-lived large structures are relatively rare and are almost always better handled by the programmers themselves. Keep in mind that the technique used by Clojure only speeds up tests between unequal objects, and that newly created objects need to have their hash computed first so comparisons involving short-lived objects become significantly slower than a naive equality check.

If you’re working with large structures that require structural comparison, e.g. syntax trees, it’s far better to just build them with that in mind to begin with. Hash-consing is trivial to implement and gives you constant-time equality checks without any fuss.

1 Like