[Python-Dev] Frame zombies

Eyal Lotem eyal.lotem at gmail.com
Mon Jun 11 03:54:48 CEST 2007

On 6/10/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > Note that _only_ recursions will have more than 1 frame attached.
> That's not true; in the presence of threads, the same method
> may also be invoked more than one time simultaneously.

Yes, I have missed that, and realized that I missed that myself a bit later.
I guess I can rationalize that with the fact that I myself tend to
avoid threads.

> > But removing freelist altogether will not work well with any type of
> > recursion.
> How do you know that? Did you measure the time? On what system?
> What were the results?
> Performance optimization without measuring is just unacceptable.

I agree, I may have used the wrong tone above.
Removing the freelist will probably either not have a significant
effect (at worst, its adding very little work of maintaining it), or
improve recursions and functions that tend to be running
simultaniously in multiple threads (as in those cases the realloc will
not actually resize the frame, and mallocs/free will indeed be saved).

But do note my corrected tone (I said "probably" :-) - and anyone is
welcome to try removing it and see if they get a performance benefit.

The fact threading also causes the same code object to be used in
multiple frames makes everything a little less predictable and may
mean that having a larger-than-1 number of frames associated with each
code object may indeed yield a performance benefit.

I am not sure how to benchmark such modifications. Is there any
benchmark that includes threaded use of the same functions in typical
use cases?

> Regards,
> Martin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/eyal.lotem%40gmail.com

More information about the Python-Dev mailing list