[issue12857] Expose called function on frame object

Nathaniel Smith report at bugs.python.org
Thu May 25 02:10:26 EDT 2017


Nathaniel Smith added the comment:

> Yes, whenever you touch frames you're disabling the JIT for the call site (and maybe for more call sites up the stack, idk).  So it doesn't matter what you use, `f_func` or `f_locals`, the performance will suffer big time.  Is that acceptable for Trio?

Ah, but that's the trick: with f_func the only time I have to touch frames is from my SIGINT handler, and its fine if *that* drops us out of the JIT (it probably has to in any case). The rest of the time, the interpreter would be automatically tracking all the state I need, so it's effectively free, and PyPy can do all its normal magic. The problem with using locals() / f_locals for this is that I have to constantly touch them during normal execution.

(Probably we shouldn't make a huge deal out of the PyPy case though – for me the main advantages of f_func are the simplicity and atomicity. But FWIW I also just pinged Armin on #pypy and he said that PyPy wouldn't have a problem supporting f_func.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12857>
_______________________________________


More information about the Python-bugs-list mailing list