• Brad Fitzpatrick's avatar
    net/http: simplify transfer body; reduces allocations too · 27f74279
    Brad Fitzpatrick authored
    benchmark                                   old ns/op    new ns/op    delta
    BenchmarkServerFakeConnNoKeepAlive              14431        14247   -1.28%
    BenchmarkServerFakeConnWithKeepAlive            11618        11357   -2.25%
    BenchmarkServerFakeConnWithKeepAliveLite         6735         6427   -4.57%
    BenchmarkServerHandlerTypeLen                    8842         8740   -1.15%
    BenchmarkServerHandlerNoLen                      8001         7828   -2.16%
    BenchmarkServerHandlerNoType                     8270         8227   -0.52%
    BenchmarkServerHandlerNoHeader                   6148         5920   -3.71%
    
    benchmark                                  old allocs   new allocs    delta
    BenchmarkServerFakeConnNoKeepAlive                 30           29   -3.33%
    BenchmarkServerFakeConnWithKeepAlive               25           24   -4.00%
    BenchmarkServerFakeConnWithKeepAliveLite           10            9  -10.00%
    BenchmarkServerHandlerTypeLen                      18           17   -5.56%
    BenchmarkServerHandlerNoLen                        15           14   -6.67%
    BenchmarkServerHandlerNoType                       16           15   -6.25%
    BenchmarkServerHandlerNoHeader                     10            9  -10.00%
    
    benchmark                                   old bytes    new bytes    delta
    BenchmarkServerFakeConnNoKeepAlive               2557         2492   -2.54%
    BenchmarkServerFakeConnWithKeepAlive             2260         2194   -2.92%
    BenchmarkServerFakeConnWithKeepAliveLite         1092         1026   -6.04%
    BenchmarkServerHandlerTypeLen                    1941         1875   -3.40%
    BenchmarkServerHandlerNoLen                      1898         1832   -3.48%
    BenchmarkServerHandlerNoType                     1906         1840   -3.46%
    BenchmarkServerHandlerNoHeader                   1092         1026   -6.04%
    
    Update #5195
    
    R=golang-dev, daniel.morsing
    CC=golang-dev
    https://golang.org/cl/9492044
    27f74279
transfer.go 16 KB