[pypy-dev] Small optimization

Antonio Cuni anto.cuni at gmail.com
Wed Oct 24 16:32:50 CEST 2007

Christian Tismer wrote:
>> Isn't this the optimization that Michael already tried? See 
>> objspace/std/objspace.py line 65. command line option is 
>> --objspace-std-withsmallint
>> I turned out to not be worth it in many cases.
> But it is known as a useful special case in the CPython interpreter loop.

moreover, according to Jim Hugunin, it's also an useful optimization in 
IronPython, that's why I decided to try it.

Btw, I choose int+int for the example but in theory we could apply the 
same technique to other cases, says getitem on list and int or getattr 
on instances and string. I mean, they are the common cases so it might 
be worth of special casing them; of course not manually, that's not the 
pypy way :-).

ciao Anto

More information about the Pypy-dev mailing list