Serhiy Storchaka added the comment:

> 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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19087>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to