]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/6g: inline copies of up to 4 words in length.
authorKeith Randall <khr@golang.org>
Mon, 30 Dec 2013 20:14:27 +0000 (12:14 -0800)
committerKeith Randall <khr@golang.org>
Mon, 30 Dec 2013 20:14:27 +0000 (12:14 -0800)
This change fixes a serious performance regression
with reflect.Value growing to 4 words instead of 3.
The json benchmark was ~50% slower, with this change
it is ~5% slower (and the binary is 0.5% larger).

Longer term, we probably need to rethink our copy
generation.  Using REP is really expensive time-wise.
But inlining the copy grows the binary.

R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/44990043

src/cmd/6g/cgen.c

index ada2baa81c143c5ced50bf2e3839577b0e41f85c..da16071a8d955ddc6cbaae0bf3de177e87c9f608 100644 (file)
@@ -1513,7 +1513,7 @@ componentgen(Node *nr, Node *nl)
                                fatal("componentgen: not a TFIELD: %lT", t);
                        fldcount++;
                }
-               if(fldcount == 0 || fldcount > 3)
+               if(fldcount == 0 || fldcount > 4)
                        goto no;
 
                break;