• Russ Cox's avatar
    cmd/gc: add 2-, 3-, 4-word write barrier specializations · a3416cf5
    Russ Cox authored
    Assignments of 2-, 3-, and 4-word values were handled
    by individual MOV instructions (and for scalars still are).
    But if there are pointers involved, those assignments now
    go through the write barrier routine. Before this CL, they
    went to writebarrierfat, which calls memmove.
    Memmove is too much overhead for these small
    amounts of data.
    
    Instead, call writebarrierfat{2,3,4}, which are specialized
    for the specific amount of data being copied.
    Today the write barrier does not care which words are
    pointers, so size alone is enough to distinguish the cases.
    If we keep these distinctions in Go 1.5 we will need to
    expand them for all the pointer-vs-scalar possibilities,
    so the current 3 functions will become 3+7+15 = 25,
    still not a large burden (we deleted more morestack
    functions than that when we dropped segmented stacks).
    
    BenchmarkBinaryTree17           3250972583  3123910344  -3.91%
    BenchmarkFannkuch11             3067605223  2964737839  -3.35%
    BenchmarkFmtFprintfEmpty        101         96.0        -4.95%
    BenchmarkFmtFprintfString       267         235         -11.99%
    BenchmarkFmtFprintfInt          261         253         -3.07%
    BenchmarkFmtFprintfIntInt       444         402         -9.46%
    BenchmarkFmtFprintfPrefixedInt  374         346         -7.49%
    BenchmarkFmtFprintfFloat        472         449         -4.87%
    BenchmarkFmtManyArgs            1537        1476        -3.97%
    BenchmarkGobDecode              13986528    12432985    -11.11%
    BenchmarkGobEncode              13120323    12537420    -4.44%
    BenchmarkGzip                   451925758   437500578   -3.19%
    BenchmarkGunzip                 113267612   110053644   -2.84%
    BenchmarkHTTPClientServer       103151      77100       -25.26%
    BenchmarkJSONEncode             25002733    23435278    -6.27%
    BenchmarkJSONDecode             94213717    82568789    -12.36%
    BenchmarkMandelbrot200          4804246     4713070     -1.90%
    BenchmarkGoParse                4646114     4379456     -5.74%
    BenchmarkRegexpMatchEasy0_32    163         158         -3.07%
    BenchmarkRegexpMatchEasy0_1K    433         391         -9.70%
    BenchmarkRegexpMatchEasy1_32    154         138         -10.39%
    BenchmarkRegexpMatchEasy1_1K    1481        1132        -23.57%
    BenchmarkRegexpMatchMedium_32   282         270         -4.26%
    BenchmarkRegexpMatchMedium_1K   92421       86149       -6.79%
    BenchmarkRegexpMatchHard_32     5209        4718        -9.43%
    BenchmarkRegexpMatchHard_1K     158141      147921      -6.46%
    BenchmarkRevcomp                699818791   642222464   -8.23%
    BenchmarkTemplate               132402383   108269713   -18.23%
    BenchmarkTimeParse              509         478         -6.09%
    BenchmarkTimeFormat             462         456         -1.30%
    
    LGTM=r
    R=r
    CC=golang-codereviews
    https://golang.org/cl/156200043
    a3416cf5
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...