To quote from PEP 424:
Rationale
=
Being able to pre-allocate lists based on the expected size, as estimated by
``__length_hint__``, can be a significant optimization. CPython has been
observed to run some code faster than PyPy, purely because of this optimization
being present.
Mark Shannon, 16.07.2012 10:37:
If resizing of lists is too slow, then we should reconsider the 9/8 factor
and/or look to tweak the resizing code.
The thing is that the performance is platform specific. On systems with a
fast memory allocator, especially on Linux, the difference is negligible.
On Jul 16, 2012, at 1:37 AM, Mark Shannon wrote:
To quote from PEP 424:
Rationale
=
Being able to pre-allocate lists based on the expected size, as estimated by
``__length_hint__``, can be a significant optimization. CPython has been
observed to run some code faster than PyPy,
On Mon, Jul 16, 2012 at 11:02 AM, Stefan Behnel stefan...@behnel.de wrote:
Mark Shannon, 16.07.2012 10:37:
If resizing of lists is too slow, then we should reconsider the 9/8
factor
and/or look to tweak the resizing code.
The thing is that the performance is platform specific. On systems
Speaking of which - I find this bikeshed disgusting.
Disgusting? Irritating, perhaps, but why should a PEP -- even one whose
purpose is to codify existing practice -- not result in discussions
about its subject matter?
The final P stands for Proposal, not for Pronouncement.
TJG
Maciej Fijalkowski, 16.07.2012 11:14:
On Mon, Jul 16, 2012 at 11:02 AM, Stefan Behnel wrote:
Mark Shannon, 16.07.2012 10:37:
If resizing of lists is too slow, then we should reconsider the 9/8
factor and/or look to tweak the resizing code.
The thing is that the performance is platform
*If* resizing list is so slow, then why not make it faster?
A simple solution to speed up such problem is to change the
overallocation factor, but it may waste memory. Python tries to be
fast and to not waste too much memory.
Why is it a significant optimisation?
How much slower is it?
Where
On Mon, Jul 16, 2012 at 7:21 PM, Tim Golden m...@timgolden.me.uk wrote:
Speaking of which - I find this bikeshed disgusting.
Disgusting? Irritating, perhaps, but why should a PEP -- even one whose
purpose is to codify existing practice -- not result in discussions
about its subject matter?
On Mon, 16 Jul 2012 23:23:18 +1000
Nick Coghlan ncogh...@gmail.com wrote:
- distinguishing between different reasons for saying don't
preallocate any space (i.e. returning zero). I still haven't heard a
convincing rationale for this one
The point is that zero is a valid value for a length
On Tue, Jul 17, 2012 at 12:01 AM, Antoine Pitrou solip...@pitrou.net wrote:
On Mon, 16 Jul 2012 23:23:18 +1000
Nick Coghlan ncogh...@gmail.com wrote:
- distinguishing between different reasons for saying don't
preallocate any space (i.e. returning zero). I still haven't heard a
convincing
On Tue, 17 Jul 2012 00:18:55 +1000
Nick Coghlan ncogh...@gmail.com wrote:
Given that all standard library containers default to assuming a size
of zero (absent information indicating otherwise), and a special value
would need to be special cased by *every* client of the API (and
almost
11 matches
Mail list logo