[Python-Dev] Optimization

Antoine Pitrou solipsis at pitrou.net
Sat Oct 5 23:18:07 CEST 2013


On Sun, 06 Oct 2013 00:02:14 +0300
Serhiy Storchaka <storchaka at gmail.com> wrote:
> 05.10.13 23:11, Georg Brandl написав(ла):
> > Am 05.10.2013 21:42, schrieb Serhiy Storchaka:
> >> Please remember me, what was common decision about CPython-only
> >> optimizations which change computation complexity? I.g. constant
> >> amortization time of += for byte objects and strings, or linear time of
> >> sum() for sequences?
> >
> > This appears to be about changeset 499a96611baa:
> >
> >    Issue #19087: Improve bytearray allocation in order to allow cheap popping of
> > data at the front (slice deletion).
> 
> I just need something to which I can refer in similar situations (there 
> was several similar rejected proposition last months).

Sometimes there are no hard rules, and several factors can combine into
a decision. Complexity of implementation and existing alternatives are
useful guidelines, IMHO.

Optimized "+=" for strings has been re-enabled after PEP 393, IIRC.

Regards

Antoine.




More information about the Python-Dev mailing list