You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into an issue where the comparison of a struct type containing lots of arrays took super long. After adding cmpopts.EquateComparable to the check the comparison is more than 10x faster. I think it should be okay to compare arrays of basic types (e.g. [32]byte) using == by default.
As a point of semantic correctness we have to descend into each individual byte element if there were any options that are possibly applicable. However, we could short-circuit the evaluation if we detect that no option could possibly be applicable. Note that if the caller passes in any cmp.FilterPath options, then we cannot do the short-circuit since this option is Turing complete and we cannot prove that it wouldn't match on individual byte values.
I ran into an issue where the comparison of a struct type containing lots of arrays took super long. After adding
cmpopts.EquateComparable
to the check the comparison is more than 10x faster. I think it should be okay to compare arrays of basic types (e.g.[32]byte
) using==
by default.Example Benchmark:
Results:
The text was updated successfully, but these errors were encountered: