Open
Description
TinyGo uses the bytes
package from upstream Go.
// Equal reports whether a and b
// are the same length and contain the same bytes.
// A nil argument is equivalent to an empty slice.
func Equal(a, b []byte) bool {
// Neither cmd/compile nor gccgo allocates for these string conversions.
return string(a) == string(b)
}
However, the []byte->string
conversion does allocate on TinyGo. We should replace calls to bytes.Equal
with a call to our own function that doesn't allocate.