[Python-Dev] Tagged integers

Jeff Epler jepler at unpythonic.net
Wed Jul 14 18:28:27 CEST 2004

I tried this back in 2002.


Subject: [Python-Dev] Performance (non)optimization: 31-bit ints in pointers
| Performance results are mixed.  A small program designed to test the
| speed of all-integer arithmetic comes out faster by 14% (3.38 vs 2.90
| "user" time on my machine) but pystone comes out 5% slower (14124 vs 13358
| "pystones/second").
| I don't know if anybody's barked up this tree before, but I think
| these results show that it's almost certainly not worth the effort to
| incorporate this "performance" hack in Python.  I'll keep my tree around
| for awhile, in case anybody else wants to see it, but beware that it
| still has serious issues even in the core:
|     >>> 0+0j
|     Traceback (most recent call last):
|       File "<stdin>", line 1, in ?
|     TypeError: unsupported operand types for +: 'int' and 'complex'
|     >>> (0).__class__
|     Segmentation fault

Guido replied:
| We used *exactly* this approach in ABC.  I decided not to go with it
| in Python, for two reasons that are essentially what you write up
| here: (1) the changes are very pervasive (in ABC, we kept finding
| places where we had pointer-manipulating code that had to be fixed to
| deal with the small ints), and (2) it wasn't at all clear if it was a
| performance win in the end (all the extra tests and special cases
| may cost as much as you gain).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20040714/47519ac4/attachment.pgp

More information about the Python-Dev mailing list