diff options
author | Russ Cox <rsc@golang.org> | 2014-04-03 19:05:17 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-04-03 19:05:17 -0400 |
commit | 100ba6af330411bbfa518fb977303c4fb1324fa2 (patch) | |
tree | ccf559629ae33b59943fc5be78b9de077dc97cfa /src/cmd/gc/walk.c | |
parent | b11f9b8bd074cf9c2e18cc154a9c4ad4fa043832 (diff) | |
download | go-100ba6af330411bbfa518fb977303c4fb1324fa2.tar.gz |
cmd/gc, runtime: optimize map[string] lookup from []byte key
Brad has been asking for this for a while.
I have resisted because I wanted to find a more general way to
do this, one that would keep the performance of code introducing
variables the same as the performance of code that did not.
(See golang.org/issue/3512#c20).
I have not found the more general way, and recent changes to
remove ambiguously live temporaries have blown away the
property I was trying to preserve, so that's no longer a reason
not to make the change.
Fixes issue 3512.
LGTM=iant
R=iant
CC=bradfitz, golang-codereviews, khr, r
https://codereview.appspot.com/83740044
Diffstat (limited to 'src/cmd/gc/walk.c')
-rw-r--r-- | src/cmd/gc/walk.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 1ffe8937f..3bb48fdbb 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -1316,6 +1316,11 @@ walkexpr(Node **np, NodeList **init) n = mkcall("slicebytetostring", n->type, init, n->left); goto ret; + case OARRAYBYTESTRTMP: + // slicebytetostringtmp([]byte) string; + n = mkcall("slicebytetostringtmp", n->type, init, n->left); + goto ret; + case OARRAYRUNESTR: // slicerunetostring([]rune) string; n = mkcall("slicerunetostring", n->type, init, n->left); |