Skip to content

Commit

Permalink
update:Reduce buffer allocation times to improve efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
wzy2687 committed Jul 25, 2023
1 parent ca3f840 commit efeceac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions znet/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,15 @@ func (c *Connection) StartReader() {
}
}()

//Reduce buffer allocation times to improve efficiency
// add by ray 2023-02-03
buffer := make([]byte, zconf.GlobalObject.IOReadBuffSize)

for {
select {
case <-c.ctx.Done():
return
default:
// add by uuxia 2023-02-03
buffer := make([]byte, zconf.GlobalObject.IOReadBuffSize)

// read data from the connection's IO into the memory buffer
// (从conn的IO中读取数据到内存缓冲buffer中)
Expand Down

0 comments on commit efeceac

Please sign in to comment.