[Python-Dev] Performance (non)optimization: 31-bit ints in pointers

Martin v. Loewis martin@v.loewis.de
13 Aug 2002 01:04:48 +0200


Guido van Rossum <guido@python.org> writes:

> In Python I decided to stay away from cleverness except when
> extensive performance analysis showed there was a real need to speed
> something up.  That got us super-fast dicts, for example, and .pyc
> files to cache the work of the (slow, but trick-free) parser.

For small ints, it also got you the small int cache, which has nearly
the same storage requirements as a pointer-as-int, and is probably as
expensive (you can drop the tests for odd addresses, but need to add
increfs and decrefs for ints).

Regards,
Martin