[Python-Dev] [ python-Patches-876206 ] scary frame speed hacks
Neal Norwitz
neal at metaslash.com
Tue Mar 2 21:15:41 EST 2004
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.
My goal was to drop the frame size small enough for PyMalloc.
I don't think I ever tried to change the allocs. But since
I never got it faster, I dropped it.
Neal
More information about the Python-Dev
mailing list