David Wilson added the comment:

This new patch abandons the buffer interface and specializes for Bytes per the 
comments on this issue.

Anyone care to glance at least at the general structure?

Tests could probably use a little more work.

Microbenchmark seems fine, at least for construction. It doesn't seem likely 
this patch would introduce severe performance troubles elsewhere, but I'd like 
to trying it out with some example heavy BytesIO consumers (any suggestions? 
Some popular template engine?)

cpython] ./python.exe -m timeit -s 'import i' 'i.readlines()'
lines: 54471
100 loops, best of 3: 13.3 msec per loop

[23:52:55 eldil!58 cpython] ./python-nocow -m timeit -s 'import i' 
'i.readlines()'
lines: 54471
10 loops, best of 3: 19.6 msec per loop

[23:52:59 eldil!59 cpython] cat i.py
import io
word = b'word'
line = (word * int(79/len(word))) + b'\n'
ar = line * int((4 * 1048576) / len(line))
def readlines():
    return len(list(io.BytesIO(ar)))
print('lines: %s' % (readlines(),))

----------
Added file: http://bugs.python.org/file36078/cow5.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22003>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to