[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread STINNER Victor
STINNER Victor added the comment: > Is it worth to optimize this pretty rare special case? There was a TODO in the code, so I guess that the author wanted to write specialized code for 1-char replacement. Since the patch is short (adds 8 lines of C code), I consider that it's ok to optimize it

[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Is it worth to optimize this pretty rare special case? -- nosy: +serhiy.storchaka ___ Python tracker ___ _

[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread STINNER Victor
STINNER Victor added the comment: I pushed my latest patches, thanks for your contribution Josh. -- resolution: -> fixed status: open -> closed ___ Python tracker ___ __

[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread Roundup Robot
Roundup Robot added the comment: New changeset 62e3b7af0697 by Victor Stinner in branch 'default': Optimize bytes.replace(b'', b'.') https://hg.python.org/cpython/rev/62e3b7af0697 -- nosy: +python-dev ___ Python tracker

[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread STINNER Victor
STINNER Victor added the comment: I wrote a microbenchmark with my benchmark.py tool. The patch always make bytes.replace(b'', char) and bytearray.replace(b'', char) faster even for strings of 10 bytes, the speedup on string of 1000 bytes or more is very interesting, even I never used this Pyt

[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-20 Thread STINNER Victor
STINNER Victor added the comment: I reviewed your patch on Rietveld (you should get an email notification). -- nosy: +haypo ___ Python tracker ___ ___

[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-19 Thread Josh Snider
New submission from Josh Snider: replace_interleave in Objects/bytesobject.c and Objects/bytearrayobject.c can be optimized for the special case where the interleaving byte string is a single character. Here's some quick results from timeit showing that it's about three times faster for the s

[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-19 Thread Josh Snider
Josh Snider added the comment: Addresses review comments. -- Added file: http://bugs.python.org/file42180/bytes-2.patch ___ Python tracker ___ ___