[Python-ideas] Expansion of the range of small integers
Christian Heimes
christian at python.org
Mon Sep 17 20:28:41 CEST 2012
Am 17.09.2012 19:49, schrieb Terry Reedy:
> In 2.x before 3.0, the range was about -5 to 10 or so ;-).
> It was expanded when bytes were added.
2.2 had -1 to 99. The numbers grew slowly to -5 to 256 in 2.6.
> It might be interesting to instrument the int allocator to count
> allocations of ints up to say 10000 in real apps.
You can easily test how different settings affect the interpreter with
some compiler flags:
CFLAGS="-DCOUNT_ALLOCS=1 -DNSMALLPOSINTS=10000 -DNSMALLNEGINTS=10000"
./configure && make
COUNT_ALLOCS slows down the interpreter a bit. It prints some stats at
shutdown.
> What is hard to guess is the effect on cache hits and misses in real apps.
Real apps may even save memory when they use lots of ints > 256.
Christian
More information about the Python-ideas
mailing list