Commit Graph

8 Commits

Author SHA1 Message Date
Soheil Hassas Yeganeh
ad1b3e5094 Introduce grpc_byte_buffer_reader_peek and use it for Protobuf parsing.
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 509e77a5a3
2019-03-21 06:03:45 -04:00
Soheil Hassas Yeganeh
c060d55cc7 Revert "Introduce grpc_byte_buffer_reader_peek and use it for Protobuf parsing." 2019-03-05 14:01:01 -05:00
Soheil Hassas Yeganeh
509e77a5a3 Introduce grpc_byte_buffer_reader_peek and use it for Protobuf parsing.
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()
2019-03-04 14:17:46 -05:00
Yash Tibrewal
3a2cfe50ec Rever copyright changes 2019-01-28 16:18:49 -08:00
Yash Tibrewal
4dcb14ec9e Fix codegen_test_minimal 2019-01-24 13:05:05 -08:00
Yash Tibrewal
63bdf4e236 More changes for client interception 2018-10-16 14:10:02 -07:00
ncteisen
cf5b2666e1 Make GrpcProtoBufferReaderWriter public 2018-04-06 07:05:27 -07:00
Muxi Yan
0e00c43082 Move headers from grpc++ to grpcpp 2018-02-15 14:49:34 -08:00