[Python-Dev] [ python-Patches-876206 ] scary frame speed hacks

Christian Tismer tismer at stackless.com
Tue Mar 2 21:22:51 EST 2004


Neal Norwitz wrote:

> On Wed, Mar 03, 2004 at 03:03:19PM +1300, Greg Ewing wrote:
> 
>>"Phillip J. Eby" <pje at telecommunity.com>:
>>
>>
>>>Frames are over three times larger than a function and a code object put 
>>>together:
>>
>>Yow! I hadn't realised that.
>>
>>Do frames *really* need to be that big...?
> 
> 
> In Include/frameobject.h, b_type and b_level can be combined to
> a single 32-bit value, rather than two in PyTryBlock.  There
> is a bit more processing to pull the values apart.  IIRC,
> there was a very small, but measurable performance hit.
> You can also decrease CO_MAXBLOCKS.  I was able to drop the
> size to under 256 bytes.  But perf was still a bit off.

I think instead of or in addition to folding block items,
the maximum size of the blockstack *could* be computed
at compile time, instead of a fixed 20 level deep structure.
It would complicate things a little more, again, but memory
savings would be great.

ciao - chris

p.s.:
For a small but simple saving: f_tstate can be completely dropped.
Did it for Stackless, already. Maybe I'll submit a patch. :-)

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/




More information about the Python-Dev mailing list