• Brad Fitzpatrick's avatar
    net/http: fewer allocations in the server path · d4cbc80d
    Brad Fitzpatrick authored
    Don't allocate for the Date or Content-Length headers.
    A custom Date header formatter replaces use of time.Format.
    
    benchmark                                   old ns/op    new ns/op    delta
    BenchmarkClientServer                           67791        64424   -4.97%
    BenchmarkClientServerParallel4                  62956        58533   -7.03%
    BenchmarkClientServerParallel64                 62043        54789  -11.69%
    BenchmarkServer                                254609       229060  -10.03%
    BenchmarkServerFakeConnNoKeepAlive              17038        16316   -4.24%
    BenchmarkServerFakeConnWithKeepAlive            14184        13226   -6.75%
    BenchmarkServerFakeConnWithKeepAliveLite         8591         7532  -12.33%
    BenchmarkServerHandlerTypeLen                   10750         9961   -7.34%
    BenchmarkServerHandlerNoLen                      9535         8935   -6.29%
    BenchmarkServerHandlerNoType                     9858         9362   -5.03%
    BenchmarkServerHandlerNoHeader                   7754         6856  -11.58%
    
    benchmark                                  old allocs   new allocs    delta
    BenchmarkClientServer                              68           66   -2.94%
    BenchmarkClientServerParallel4                     68           66   -2.94%
    BenchmarkClientServerParallel64                    68           66   -2.94%
    BenchmarkServer                                    21           19   -9.52%
    BenchmarkServerFakeConnNoKeepAlive                 32           30   -6.25%
    BenchmarkServerFakeConnWithKeepAlive               27           25   -7.41%
    BenchmarkServerFakeConnWithKeepAliveLite           12           10  -16.67%
    BenchmarkServerHandlerTypeLen                      19           18   -5.26%
    BenchmarkServerHandlerNoLen                        17           15  -11.76%
    BenchmarkServerHandlerNoType                       17           16   -5.88%
    BenchmarkServerHandlerNoHeader                     12           10  -16.67%
    
    Update #5195
    
    R=nigeltao
    CC=golang-dev
    https://golang.org/cl/9432046
    d4cbc80d
Name
Last commit
Last update
..
cgi Loading commit data...
cookiejar Loading commit data...
fcgi Loading commit data...
httptest Loading commit data...
httputil Loading commit data...
pprof Loading commit data...
testdata Loading commit data...
chunked.go Loading commit data...
chunked_test.go Loading commit data...
client.go Loading commit data...
client_test.go Loading commit data...
cookie.go Loading commit data...
cookie_test.go Loading commit data...
doc.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
filetransport.go Loading commit data...
filetransport_test.go Loading commit data...
fs.go Loading commit data...
fs_test.go Loading commit data...
header.go Loading commit data...
header_test.go Loading commit data...
jar.go Loading commit data...
lex.go Loading commit data...
lex_test.go Loading commit data...
npn_test.go Loading commit data...
proxy_test.go Loading commit data...
range_test.go Loading commit data...
readrequest_test.go Loading commit data...
request.go Loading commit data...
request_test.go Loading commit data...
requestwrite_test.go Loading commit data...
response.go Loading commit data...
response_test.go Loading commit data...
responsewrite_test.go Loading commit data...
serve_test.go Loading commit data...
server.go Loading commit data...
server_test.go Loading commit data...
sniff.go Loading commit data...
sniff_test.go Loading commit data...
status.go Loading commit data...
transfer.go Loading commit data...
transfer_test.go Loading commit data...
transport.go Loading commit data...
transport_test.go Loading commit data...
triv.go Loading commit data...
z_last_test.go Loading commit data...