help wantedtype/enhancementtype/performance
倉庫指標
- Star
- (40,090 star)
- PR 合併指標
- (平均合併 14天 4小時) (30 天內合併 346 個 PR)
描述
Enhancement
When we want to return the packages to the client, our logic is:
- Prepare the packet and serialize it to a buffer allocated by the area.Allocator
- Write this data through packetIO.WritePacket, in the WritePacket, the data will be cached in a buffer writer
- Flush the buffer writer to the connection
Mostly, e.g, for write ok https://github.com/pingcap/tidb/blob/0c19f927419f6b043a345e4a2af5336272830229/server/conn.go#L1442, we can see that we don't need to double copy the buffer, we can serialize the data and write it directly to the connection.