• Meir Fischer's avatar
    http2: remove unnecessary TODO for trailer keys allocation · 69d4b8aa
    Meir Fischer authored
    strings.Join has two allocations:
    (1) []byte intermediate
    (2) final string conversion
    The comma-separated keys are ultimately stored in hpack.HeaderField.Value
    as a string so (2) is not wasteful. Because strings.Join is used so heavily
    I assume its implementation is optimal - (1) is necessary.
    Therefore, short of refactoring hpack.HeaderField's Value type, the status quo
    seems optimal.
    
    This TODO appears to have been copy-pasted from net/http/transfer.go
    However, the two cases are different. transfer.go has two allocations
    in addition to strings.Join: concatenation with literals and converting
    string to bytes in io.WriteString.
    
    Change-Id: I292203a6535dd2774f5bf45e7280b89aabb5d78d
    Reviewed-on: https://go-review.googlesource.com/34626Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    69d4b8aa
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...
go18_test.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...
not_go18.go Loading commit data...
pipe.go Loading commit data...
pipe_test.go Loading commit data...
server.go Loading commit data...
server_push_test.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...