• Brad Fitzpatrick's avatar
    http2: optimize server frame writes · e7b14352
    Brad Fitzpatrick authored
    Don't do async frame writes when the write is known to be small enough
    to definitely fit in the write buffer and not cause a flush (which
    might block). This avoids starting a new goroutine and doing a channel
    send operation for many frame writes.
    
    name                  old time/op    new time/op    delta
    ServerGets-4             146µs ± 2%     144µs ± 1%  -1.46%        (p=0.000 n=14+14)
    ServerPosts-4            162µs ± 1%     160µs ± 1%  -1.15%        (p=0.000 n=15+15)
    Server_GetRequest-4      145µs ± 1%     143µs ± 0%  -1.26%        (p=0.000 n=15+15)
    Server_PostRequest-4     160µs ± 1%     158µs ± 1%  -1.32%        (p=0.000 n=15+15)
    
    The headers frame is the main last one which might show some benefit
    if there's a cheap enough way to conservatively calculate its size.
    
    Change-Id: I9be2ddbf04689340819d8701ea671fff378d9e79
    Reviewed-on: https://go-review.googlesource.com/31495
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    e7b14352
Name
Last commit
Last update
..
h2demo Loading commit data...
h2i Loading commit data...
hpack Loading commit data...
testdata Loading commit data...
.gitignore Loading commit data...
Dockerfile Loading commit data...
Makefile Loading commit data...
README Loading commit data...
client_conn_pool.go Loading commit data...
configure_transport.go Loading commit data...
errors.go Loading commit data...
errors_test.go Loading commit data...
fixed_buffer.go Loading commit data...
fixed_buffer_test.go Loading commit data...
flow.go Loading commit data...
flow_test.go Loading commit data...
frame.go Loading commit data...
frame_test.go Loading commit data...
go16.go Loading commit data...
go17.go Loading commit data...
go17_not18.go Loading commit data...
go18.go Loading commit data...
gotrack.go Loading commit data...
gotrack_test.go Loading commit data...
headermap.go Loading commit data...
http2.go Loading commit data...
http2_test.go Loading commit data...
not_go16.go Loading commit data...
not_go17.go Loading commit data...
pipe.go Loading commit data...
pipe_test.go Loading commit data...
server.go Loading commit data...
server_test.go Loading commit data...
transport.go Loading commit data...
transport_test.go Loading commit data...
write.go Loading commit data...
writesched.go Loading commit data...
writesched_priority.go Loading commit data...
writesched_priority_test.go Loading commit data...
writesched_random.go Loading commit data...
writesched_random_test.go Loading commit data...
writesched_test.go Loading commit data...
z_spec_test.go Loading commit data...