[Python-checkins] cpython: asynchat speedup improvement: avoid to use a function mimicking old buffer()
giampaolo.rodola
python-checkins at python.org
Sat Aug 4 14:38:26 CEST 2012
http://hg.python.org/cpython/rev/ab959a5b04a0
changeset: 78408:ab959a5b04a0
user: Giampaolo Rodola' <g.rodola at gmail.com>
date: Sat Aug 04 14:38:16 2012 +0200
summary:
asynchat speedup improvement: avoid to use a function mimicking old buffer() builtin behavior; instead use plain slicing
files:
Lib/asynchat.py | 14 +-------------
1 files changed, 1 insertions(+), 13 deletions(-)
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -49,18 +49,6 @@
import asyncore
from collections import deque
-def buffer(obj, start=None, stop=None):
- # if memoryview objects gain slicing semantics,
- # this function will change for the better
- # memoryview used for the TypeError
- memoryview(obj)
- if start == None:
- start = 0
- if stop == None:
- stop = len(obj)
- x = obj[start:stop]
- ## print("buffer type is: %s"%(type(x),))
- return x
class async_chat (asyncore.dispatcher):
"""This is an abstract class. You must derive from this class, and add
@@ -240,7 +228,7 @@
# handle classic producer behavior
obs = self.ac_out_buffer_size
try:
- data = buffer(first, 0, obs)
+ data = first[:obs]
except TypeError:
data = first.more()
if data:
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list