This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients pitrou, serhiy.storchaka, vstinner
Date 2016-09-10.09:39:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473500390.58.0.398746604196.issue28004@psf.upfronthosting.co.za>
In-reply-to
Content
Tests in the article don't look reliable. For example bytes_percent() and bytes_plus() test nothing, because b"%s %s" % (b"hi", b"there") and b"hi" + b" " + b"there" are evaluated at compile time.

Yes, bytes.join(sequence) is a little slower on Python 3 for short sequences. But for long sequences Python 3 is faster.

The code for bytes.join() is already too complex, and the proposed optimization makes it more complicated. And the optimization decreases performance on my netbook:

$ ./python -m timeit -s "sep=b' '; seq=(b'hello', b'world')" -- 'sep.join(seq); sep.join(seq); sep.join(seq); sep.join(seq); sep.join(seq); sep.join(seq); sep.join(seq); sep.join(seq); sep.join(seq); sep.join(seq)'

Python 2.7: 100000 loops, best of 3: 7.24 usec per loop
Python 3.6 unpatched: 100000 loops, best of 3: 8.62 usec per loop
Python 3.6 patched: 100000 loops, best of 3: 9.11 usec per loop
History
Date User Action Args
2016-09-10 09:39:50serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, vstinner
2016-09-10 09:39:50serhiy.storchakasetmessageid: <1473500390.58.0.398746604196.issue28004@psf.upfronthosting.co.za>
2016-09-10 09:39:50serhiy.storchakalinkissue28004 messages
2016-09-10 09:39:50serhiy.storchakacreate