[Python-ideas] Expansion of the range of small integers

Jim Jewett jimjjewett at gmail.com
Tue Sep 18 02:14:09 CEST 2012


On 9/17/12, Serhiy Storchaka <storchaka at gmail.com> wrote:
> Now in the CPython small integer numbers from -5 up to 256 inclusive are
> preallocated at the start. It allows to reduce memory consumption and
> time of creation of the integers in this range. In particular this
> affects the speed of short enumerations. Increasing the range to the
> maximum (from -32767 to 32767 inclusive), we can speed up longer
> enumerations.

On the other hand, you'll add to the memory pressure; instead of
putting the small integers and some other important objects in a
single page that probably stays loaded, there will be several
different pages to page in and out if they are useful, and to waste
startup time if they aren't.

-jJ



More information about the Python-ideas mailing list