[issue3459] optimize bytes.join()

Terry J. Reedy report at bugs.python.org
Sat Aug 2 22:36:34 CEST 2008


Terry J. Reedy <tjreedy at udel.edu> added the comment:

>bl = [b'a']*2 gives a 2% slowdown:
>bl = [b'', b'a'] gives a 20% speedup:

If the second case is less than 9% of cases, which I expect is true,
the change would cause an average slowdown ;-)

>I encountered this when trying to optimize io.BufferedReader.

Is there something peculiar about that code (and potentially fixable)
that it tries to join lots of null strings?

>I dislike this change... because of the added code complexity.

That was part of my reason for suggesting the new code be separated from
the old, but it would not much change the calculation above.
So I agree on closing this.

----------
status: pending -> closed

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


More information about the Python-bugs-list mailing list