rustc wants to use derivative to simplify PartialEq derives, but encounters a pretty significant perf hit because the derivative(PartialEq) impl will add a discriminant comparison first, unlike our hand-rolled implementations.
This PR adds a PartialEq = "skip_discriminant" mode to skip generating an initial discriminant comparison so that rustc can derive more tailored PartialEq implementations for derivative. This is proven to work.
rustc wants to use derivative to simplify
PartialEq
derives, but encounters a pretty significant perf hit because thederivative(PartialEq)
impl will add a discriminant comparison first, unlike our hand-rolled implementations.This PR adds a
PartialEq = "skip_discriminant"
mode to skip generating an initial discriminant comparison so that rustc can derive more tailoredPartialEq
implementations for derivative. This is proven to work.