From cda1839dcf942c36cba9cc782d1ac75c22a8ac4f Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Thu, 30 May 2024 12:10:35 +0800 Subject: [PATCH] opt: bring down the `maxBytesTransferET` and defer write in ET mode (#606) * opt: don't write data immediately when there is data pending in ET mode * opt: bring down the maxBytesTransferET from 4MB to 1MB --- connection_unix.go | 6 ------ eventloop_unix.go | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/connection_unix.go b/connection_unix.go index 1e59f5e77..68699f16b 100644 --- a/connection_unix.go +++ b/connection_unix.go @@ -143,9 +143,6 @@ func (c *conn) write(data []byte) (n int, err error) { // of network packets. if !c.outboundBuffer.IsEmpty() { _, _ = c.outboundBuffer.Write(data) - if isET { - err = c.loop.write(c) - } return } @@ -193,9 +190,6 @@ func (c *conn) writev(bs [][]byte) (n int, err error) { // of network packets. if !c.outboundBuffer.IsEmpty() { _, _ = c.outboundBuffer.Writev(bs) - if isET { - err = c.loop.write(c) - } return } diff --git a/eventloop_unix.go b/eventloop_unix.go index 50684a45b..71361100d 100644 --- a/eventloop_unix.go +++ b/eventloop_unix.go @@ -118,7 +118,7 @@ func (el *eventloop) read0(itf interface{}) error { return el.read(itf.(*conn)) } -const maxBytesTransferET = 1 << 22 +const maxBytesTransferET = 1 << 20 func (el *eventloop) read(c *conn) error { if !c.opened {