pgwire icon indicating copy to clipboard operation
pgwire copied to clipboard

Remove tokio codec usage for zero-copy message layer

Open sunng87 opened this issue 1 year ago • 1 comments

The encoder API of tokio-codec requires a copy when writing data, we can further seek to see if it's possible to refactor this behaviour to streamline data generation.

sunng87 avatar Mar 22 '24 21:03 sunng87

I have been working on this by changing encode method to accept a AsyncWriteExt. However, I quickly realized that it may introduces a a lot more system calls by using write_ functions directly on small data.

Overall, I think the best way is not to eliminate all copies, but only for those large chunk of bytes. This is better implemented at BufMut level to support non-continuous byte buffer.

sunng87 avatar Jul 01 '24 03:07 sunng87