I have definitely done this before in situations where equality comparison is unusually expensive, such as when it involves walking a tree. It hasn't caused any problems, and I choose to believe that it helped a bit. That said, I have never measured the effect, so I'm interested if anyone has a principled way of quantifying the performance gain. My solution to the problem of irreflexive equality was just to not care about it... YMMV on whether that's okay for your use case!
Hi everyone!
In https://github.com/haskell-unordered-containers/unordered-containers/issues/77
we're wondering whether certain Eq instances, for example record types
or strings, could be optimized by including a pointer equality check
that detects when an object is compared with itself.
Does anyone here have experience with such an optimization? Has this
been considered before, for example in GHC's deriving machinery?
One complication seems to be the correct handling of fields with
irreflexive instances, for example Float and Double. In such a case,
pointer equality doesn't imply "==-equality".
I'm looking forward to hearing your thoughts on this! :)
Cheers,
Simon
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.