[issue12805] Optimizations for bytes.join() et. al
Terry J. Reedy
report at bugs.python.org
Sun Apr 8 20:37:45 CEST 2012
Terry J. Reedy <tjreedy at udel.edu> added the comment:
Side note: Windows requires that args be quoted with ", not ', to work properly, at least with these args.
Main note: the patched test adds a space to the separator, but that is not enough to account for the difference.
c:\Programs\Python32>python -m timeit -s "seq=[bytes([i]*1000) for i in range(256)]" "b''.join(seq)"
10000 loops, best of 3: 31.7 usec per loop
c:\Programs\Python32>python -m timeit -s "seq=[bytes([i]*1000) for i in range(256)]" "b' '.join(seq)"
10000 loops, best of 3: 34.1 usec per loop
The behavior change is wrong and test_bytes.py seems to need augmentation. It begins with "XXX This is a mess. [...]".
class BaseBytesTest(unittest.TestCase):
def test_join(self)
tests b''.join([]) but as far as I can tell, not b'something'.join([]), the failing case found by Serhiy.
It end with " # XXX more...".
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12805>
_______________________________________
More information about the Python-bugs-list
mailing list