Performing an `equals()` check isn't free and can ...
# compose
j
Performing an
equals()
check isn't free and can be expensive for some objects/definitions of equals, so it wasn't clear to us if calling equals is the desirable default behavior. Also, when designing your data structures, the annotation you probably want to be using is
@Immutable
but we can't 100% safely/automatically infer the
@Immutable
annotation because it implies a forward-facing contract, so we currently require users to opt-in and thus you probably need to be annotating your data class with something anyway. That said, there is certainly an argument to be made here that
@StableMarker
should be the default, especially once we implement bitmasks which will allow us to avoid duplicating calls to
equals
. If enabling
@StableMarker
by default dramatically cuts down the average size of recompositions, it might probably be worth enabling by default. If you find yourself littering your code with this annotation, let us know, as that would provide valuable signal in informing the decision.
💯 2
👍 1