• Rémy Oudompheng's avatar
    cmd/gc: inline copy in frontend to call memmove directly. · ff416a3f
    Rémy Oudompheng authored
    A new node type OSPTR is added to refer to the data pointer of
    strings and slices in a simple way during walk(). It will be
    useful for future work on simplification of slice arithmetic.
    
    benchmark                  old ns/op    new ns/op    delta
    BenchmarkCopy1Byte                 9            8  -13.98%
    BenchmarkCopy2Byte                14            8  -40.49%
    BenchmarkCopy4Byte                13            8  -35.04%
    BenchmarkCopy8Byte                13            8  -37.10%
    BenchmarkCopy12Byte               14           12  -15.38%
    BenchmarkCopy16Byte               14           12  -17.24%
    BenchmarkCopy32Byte               19           14  -27.32%
    BenchmarkCopy128Byte              31           26  -15.29%
    BenchmarkCopy1024Byte            100           92   -7.50%
    BenchmarkCopy1String              10            7  -28.99%
    BenchmarkCopy2String              10            7  -28.06%
    BenchmarkCopy4String              10            8  -22.69%
    BenchmarkCopy8String              10            8  -23.30%
    BenchmarkCopy12String             11           11   -5.88%
    BenchmarkCopy16String             11           11   -5.08%
    BenchmarkCopy32String             15           14   -6.58%
    BenchmarkCopy128String            28           25  -10.60%
    BenchmarkCopy1024String           95           95   +0.53%
    
    R=golang-dev, bradfitz, cshapiro, dave, daniel.morsing, rsc, khr, khr
    CC=golang-dev
    https://golang.org/cl/9101048
    ff416a3f
gsubr.c 37.7 KB