[New-bugs-announce] [issue15381] Optimize BytesIO to so less reallocations when written, similarly to StringIO

Eli Bendersky report at bugs.python.org
Tue Jul 17 14:12:46 CEST 2012


New submission from Eli Bendersky <eliben at gmail.com>:

>From this pydev thread: http://mail.python.org/pipermail/python-dev/2012-July/120981.html

"BytesIO is actually missing an optimisation that is already used in
StringIO: the StringIO C implementation uses a fragment accumulator
internally, and collapses that into a single string object when
getvalue() is called. BytesIO is still using the old
"resize-the-buffer-as-you-go" strategy, and thus ends up repeatedly
reallocating the buffer as the data sequence grows incrementally.

It should be optimised to work the same way StringIO does (which is
effectively the same way that the monkeypatched version works)"

----------
components: Library (Lib)
messages: 165715
nosy: eli.bendersky, ncoghlan, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Optimize BytesIO to so less reallocations when written, similarly to StringIO
type: performance
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15381>
_______________________________________


More information about the New-bugs-announce mailing list