New submission from Antoine Pitrou <[EMAIL PROTECTED]>: When the separator is empty and the sequence only contains one non-empty item, it is possible to optimize b"".join([...]) by simply returning the non-empty item.
Since b"".join() is the recommended idiom to join large strings together, I think it can be useful. I encountered this when trying to optimize io.BufferedReader. ./python -m timeit -s "l=[b'', b'a' * 10000]" "b''.join(l)" before the patch: 100000 loops, best of 3: 2.35 usec per loop after the patch: 1000000 loops, best of 3: 0.335 usec per loop ---------- components: Interpreter Core files: bytesjoin.patch keywords: patch messages: 70365 nosy: pitrou severity: normal status: open title: optimize bytes.join() type: performance versions: Python 3.0 Added file: http://bugs.python.org/file10999/bytesjoin.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3459> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com