Brandt Bucher <brandtbuc...@gmail.com> added the comment:

Thank for the input, Serhiy. On point (1):

It's a valid concern... but I don't think it's necessarily a good enough reason 
to withhold a simple, yet *significant* performance increase for a common use 
case.

This reminds me of past CPython implementation details, such as ordered 
dictionaries in 3.6. Some users may errantly adopt problematic idioms that 
aren't strictly portable between implementations, but if you ask me the 
performance improvement (again, from quadratic to linear) for three common 
built-in types (I admit I'm being a bit generous to bytearray here ;) is well 
worth it.

Regarding (2): 

I believe that CPython lists only overallocate by something like 1/8, which in 
my opinion is a fairly conservative value. If the lists are large enough for 
this small preallocation to be a real memory burden, I would imagine that 
making the extra copies would be even worse.

And, if you ask me, list overallocation is a feature, not a bug!

----------

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

Reply via email to