[Haskell-cafe] Optimizing Eq instances with reallyUnsafePtrEquality#
Chris Smith
cdsmith at gmail.com
Tue Jun 8 14:32:24 UTC 2021
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!
On Tue, Jun 8, 2021 at 10:27 AM Simon Jakobi via Haskell-Cafe <
haskell-cafe at haskell.org> wrote:
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210608/bae5e748/attachment.html>
More information about the Haskell-Cafe
mailing list