summaryrefslogtreecommitdiff
path: root/src/cmd/gc/walk.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-04-03 19:05:17 -0400
committerRuss Cox <rsc@golang.org>2014-04-03 19:05:17 -0400
commit100ba6af330411bbfa518fb977303c4fb1324fa2 (patch)
treeccf559629ae33b59943fc5be78b9de077dc97cfa /src/cmd/gc/walk.c
parentb11f9b8bd074cf9c2e18cc154a9c4ad4fa043832 (diff)
downloadgo-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.c5
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);