[New-bugs-announce] [issue13149] optimization for append-only StringIO

Antoine Pitrou report at bugs.python.org
Tue Oct 11 03:17:34 CEST 2011

New submission from Antoine Pitrou <pitrou at free.fr>:

io.StringIO is quite slower than ''.append() when used for mass concatenation (around 5x slower). This patch brings it to similar performance by deferring construction of the internal buffer until needed.

The problem is that it's very easy to disable the optimization by calling a method other than write() and getvalue().

components: IO
files: stringio.patch
keywords: patch
messages: 145322
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: optimization for append-only StringIO
type: performance
versions: Python 3.3
Added file: http://bugs.python.org/file23373/stringio.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list