cmpstring.go
363 Bytes
-
compiler: avoid copy for string([]byte) conversion used in string comparison · 3407d165
If a string([]byte) conversion is used immediately in a string comparison, we don't need to copy the backing store of the byte slice, as the string comparison doesn't hold any reference to it. Instead, just create a string header from the byte slice and pass it for comparison. A new type of expression, String_value_expression, is introduced, for constructing string headers. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/170894 * go.dg/cmpstring.go: New test. From-SVN: r271021
Cherry Zhang committed