Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe22dca

Browse files
author
Charles-François Natali
committed
Issue #16787: Increase asyncore and asynchat default output buffers size, to
decrease CPU usage and increase throughput.
1 parent ef45380 commit fe22dca

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

Lib/asynchat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class async_chat (asyncore.dispatcher):
5656

5757
# these are overridable defaults
5858

59-
ac_in_buffer_size = 4096
60-
ac_out_buffer_size = 4096
59+
ac_in_buffer_size = 65536
60+
ac_out_buffer_size = 65536
6161

6262
# we don't want to enable the use of encoding by default, because that is a
6363
# sign of an application bug that we don't want to pass silently

Lib/asyncore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def __init__(self, sock=None, map=None):
532532

533533
def initiate_send(self):
534534
num_sent = 0
535-
num_sent = dispatcher.send(self, self.out_buffer[:512])
535+
num_sent = dispatcher.send(self, self.out_buffer[:65536])
536536
self.out_buffer = self.out_buffer[num_sent:]
537537

538538
def handle_write(self):

Misc/NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ Core and Builtins
200200
Library
201201
-------
202202

203-
- Issue 10527: make multiprocessing use poll() instead of select() if available.
203+
- Issue #16787: Increase asyncore and asynchat default output buffers size, to
204+
decrease CPU usage and increase throughput.
205+
206+
- Issue #10527: make multiprocessing use poll() instead of select() if available.
204207

205208
- Issue #16688: Fix backreferences did make case-insensitive regex fail on
206209
non-ASCII strings. Patch by Matthew Barnett.

0 commit comments

Comments
 (0)