]> Cypherpunks repositories - gostls13.git/commit
cmd/gc: don't copy []byte during string comparison
authorDmitry Vyukov <dvyukov@google.com>
Tue, 27 Jan 2015 20:57:12 +0000 (23:57 +0300)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 28 Jan 2015 19:36:50 +0000 (19:36 +0000)
commit69cd91a5981c49eaaa59b33196bdb5586c18d289
tree1fcf616422ad0317f5870c49fbff5d64c8ae932c
parent4737399bd99e5221150f508de1125cc00d329f60
cmd/gc: don't copy []byte during string comparison

Currently we allocate a new string during []byte->string conversion
in string comparison expressions. String allocation is unnecessary in
this case, because comparison does memorize the strings for later use.
This change uses slicebytetostringtmp to construct temp string directly
from []byte buffer and passes it to runtime.eqstring.

Change-Id: If00f1faaee2076baa6f6724d245d5b5e0f59b563
Reviewed-on: https://go-review.googlesource.com/3410
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/gc/order.c
src/runtime/string.go
src/runtime/string_test.go