[Python-ideas] Length hinting and preallocation for container types
Antoine Pitrou
solipsis at pitrou.net
Tue Mar 5 18:10:46 CET 2013
Le Tue, 05 Mar 2013 18:05:44 +0100,
Christian Heimes <christian at python.org> a
écrit :
> today I came across this slides
> https://speakerdeck.com/alex/why-python-ruby-and-javascript-are-slow
> by Alex Gaynor. The slides aren't some random rants on Python. Alex
> makes some valid points. Coincidentally he is a PyPy developer,
> too. ;)
Please see http://bugs.python.org/issue17338
> with LengthHint(list, 200) as lst:
> # lst has 200 ob_item slots but len(lst) == 0
> for i in range(100):
> lst.append(i*i)
> # __exit__ shrinks ob_item to 100
So how about benchmark numbers?
Regards
Antoine.
More information about the Python-ideas
mailing list