[Python-Dev] io.BytesIO slower than monkey-patching io.RawIOBase
John O'Connor
jxo6948 at rit.edu
Tue Jul 17 06:57:04 CEST 2012
>
> The second approach is consistently 10-20% faster than the first one
> (depending on input) for trunk Python 3.3
>
I think the difference is that StringIO spends extra time reallocating
memory during the write loop as it grows, whereas bytes.join computes
the allocation size first since it already knows the final length.
More information about the Python-Dev
mailing list