• Dmitriy Vyukov's avatar
    runtime: smarter slice grow · bace9523
    Dmitriy Vyukov authored
    When growing slice take into account size of the allocated memory block.
    Also apply the same optimization to string->[]byte conversion.
    Fixes #6307.
    
    benchmark                    old ns/op    new ns/op    delta
    BenchmarkAppendGrowByte        4541036      4434108   -2.35%
    BenchmarkAppendGrowString     59885673     44813604  -25.17%
    
    LGTM=khr
    R=khr
    CC=golang-codereviews, iant, rsc
    https://golang.org/cl/53340044
    bace9523
msize.c 6.04 KB