The bytes.Compare function is designed for ordering comparisons and returns -1, 0, or 1 to indicate the relative order of two byte
slices. When you only need to check equality, bytes.Compare does unnecessary work.
The bytes.Equal function is specifically optimized for equality checks. It can return early as soon as it finds a difference, and it
may use optimized assembly code for better performance on certain architectures.
Using bytes.Compare for equality checks makes your code slower and less clear about its intent. The performance difference can be
significant, especially when comparing large byte slices or when the comparison is performed frequently.
What is the potential impact?
Using bytes.Compare instead of bytes.Equal for equality checks results in unnecessary performance overhead. The impact
increases with the size of the byte slices being compared and the frequency of comparisons in your application.