Make Eq type class single method

Sven Panne svenpanne at
Wed Oct 20 16:52:19 UTC 2021

Am Mi., 20. Okt. 2021 um 17:17 Uhr schrieb Viktor Dukhovni <
ietf-dane at>:

> For primitive types CPUs often have both '==' and '/=' instructions,
> and so a direct call to `(/=)` may be more efficient than calling
> `(not .) . (==)`.  [...]

For every native code generator which is worth its salt, this shouldn't
make a difference at all. Swapping the "polarity" of a condition is an
extremely common transformation, which can be used for many reasons. And
even if you don't have anything sophisticated, a simple peephole optimizer
can get rid of the negation operation. And even if all that doesn't help:
Perhaps the negation + condition are fused together in the microcode
operations, depending on your CPU.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list