grpc_byte_buffer_reader_next() copies and references the slice. This
is not always necessary since the caller will not use the slice
after destroying the byte buffer.
A prominent example is the protobuf parser, which
calls grpc_byte_buffer_reader_next() and immediately unrefs the slice
after the call. This ref() and unref() calls can be very expensive
in the hot path.
This commit introduces grpc_byte_buffer_reader_peek() which
essentialy return a pointer to the slice in the buffer, i.e.,
no copies, and no refs.
QPS of 1MiB 1 Channel callback benchmark increases by 5%.
More importantly insructions per cycle is increased by 10%.
Also add tests and benchmarks for byte_buffer_reader_peek()
This commit reaplies
|
||
|---|---|---|
| .. | ||
| BUILD | ||
| byte_buffer_reader_test.cc | ||
| channel_create_test.cc | ||
| completion_queue_test.cc | ||
| completion_queue_threading_test.cc | ||
| concurrent_connectivity_test.cc | ||
| init_test.cc | ||
| lame_client_test.cc | ||
| num_external_connectivity_watchers_test.cc | ||
| public_headers_must_be_c89.c | ||
| secure_channel_create_test.cc | ||
| sequential_connectivity_test.cc | ||
| server_chttp2_test.cc | ||
| server_test.cc | ||