Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't construct unnecessary buffers. (#925)
Motivation: Currently the HTTP1ToGRPCServerCodec constructs a CircularBuffer that it only ever uses when doing grpc-web work. This is not the end of the world, except that CircularBuffers require memory allocations: there is no such thing as an empty CircularBuffer. In general it's not a great idea to force the mainline grpc use-case to pay for the cost of constructing a circular buffer it will never use, so instead we replace this with an optional circular buffer. That optional will be initialized on first use, so it doesn't add any complexity to our state tracking. It does add some subtle complexity to the rest of the grpc-web code, though, so we should consider increasing the priority of dealing with grpc-web properly. Modifications: - Make HTTP1ToGRPCServerCodec.responseTextBuffers optional, delay its initialization. Results: Small performance improvement on HTTP/2 server benchmarks, around 0.7% per RPC.
- Loading branch information