Reply to an old thread.

On Sat, Oct 31, 2020 at 8:02 AM Nick Coghlan <ncogh...@gmail.com> wrote:
> > Debuggers and profilers usually only care of specific frames or
> > function calls (ex: 10% of function calls or even a single function
> > call in a whole application). The problem is how to make them as
> > efficient as possible for "no operation" calls, when they don't care
> > about the current frame. Avoiding PyFrame_FastToLocalsWithError() to
> > enter the debugger/profile and avoiding PyFrame_LocalsToFast() on exit
> > sounds a simple and practical solution.
>
> Aye, I agree. I just don't think we can remove those implicit calls
> without preparing a replacement API first.

Again, I don't think that it's incompatible. We can enforce calling
PyFrame_FastToLocalsWithError() at enter and PyFrame_LocalsToFast() at
exit for now, and enhance the API later.


> Unfortunately, cell variables mean that there's no way to make
> snapshot-with-writeback logic consistently correct in the presence of
> generators and coroutines (...)

I do understand that there are corner cases where it doesn't work, ok.

But https://bugs.python.org/issue42197 is a simple and ready to merge
solution which should optimize profilers and debuggers for the most
common case.

To be clear: currently, PyFrame_FastToLocalsWithError() is called at
enter and PyFrame_LocalsToFast() is called at exit. So asking
debuggers/profilers to call them explicitly doesn't make the situation
worse (nor better ;-)) for generators/coroutines, it would be exactly
the same behavior. It's just an optimization.

The PEP 558 is being discussed for 5 years and still a draft. I don't
think that it should hold bpo-42197 optimization.

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/MV2723DT7BLHBJPNM6K4WHLTWSRMHZLN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to