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 2013-09-29.22:41:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Is there a problem with that?

No more than with msg198657.

> Sorry, I don't get your point. It's not become Python is inefficient that developers must develop workarounds.

I'm not sure that "workarounds" are much worst than using this optimization. At least we still not seen real code which will benefit from this optimization.

> Antoine's patch is simple, elegant, and offer better performances for "free".

It offer better performances for "free" only for suboptimal code which currently have O(N) instead of O(1).

One of most used cases for bytearrays is accumulating. And the patch slow down this case.

$ ./python -m timeit  "b = bytearray(); a = b'x'"  "for i in range(10000): b += a"  "bytes(b)"

Without patch: 4.3 msec per loop
With patch: 4.62 msec per loops
Date User Action Args
2013-09-29 22:41:15serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, vstinner
2013-09-29 22:41:15serhiy.storchakasetmessageid: <>
2013-09-29 22:41:15serhiy.storchakalinkissue19087 messages
2013-09-29 22:41:15serhiy.storchakacreate