[issue24138] Speed up range() by caching and modifying long objects

Marc-Andre Lemburg report at bugs.python.org
Mon May 11 13:05:13 CEST 2015


Marc-Andre Lemburg added the comment:

On 11.05.2015 11:42, Serhiy Storchaka wrote:
> 
> Pre-allocating a block has a disadvantage. It is hard to free allocated block. The program can create a lot of integers, then drop most of them, and request the memory for other needs, but blocks once allocated for integers would not freed. This is not trivial design decision and should be discussed on Python-Dev and accepted by BDFL.

True, but if it's only 1-4k RAM, I don't think anyone would mind :-)

Python 2 is doing exactly that with 1k RAM for the integer free
list. I think it was one of the first free lists ever added to
Python, so done in a time when RAM was expensive ;-).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24138>
_______________________________________


More information about the Python-bugs-list mailing list