[Python-3000] long/int unification (original) (raw)

Fredrik Lundh fredrik at pythonware.com
Fri Aug 25 11:15:37 CEST 2006


Josiah Carlson wrote:

In the integer case, it reminds me of James Knight's tagged integer patch to 2.3 [1]. If using long exclusively is 50% slower, why not try the improved speed approach?

looks like GvR was -1000 on this idea at the time, though...

Also, depending on the objects, one may consider a few other tagged objects, like perhaps None, True, and False (they could all be special values with a single tag), or even just use 31/63 bits for the tagged integer value, with a 1 in the lowest bit signifying it as a tagged integer.

iirc, my pytte1 experiment used tagged objects for integers and single- character strings, which resulting in considerable speedups for the (small set of) benchmarks I used.

(on the other hand, the dominating speedups in pytte1 were "true" GC, and call-site caching combined with streamlined method lookup. if we really want to speed things up, we should probably start with call-site caching and (explicit?) method inlining).



More information about the Python-3000 mailing list