gh-132312: Significantly reduce thread state lookups in the interpreter#151453
gh-132312: Significantly reduce thread state lookups in the interpreter#151453ZeroIntensity wants to merge 13 commits into
Conversation
|
Do you have some numbers on how much we gain with this dance? |
|
Nothing conclusive yet, no. |
|
I'm having a lot of trouble getting consistent benchmarks, unfortunately. My system seems to be too jittery to get a reliable result. I also don't know why the JIT CI is failing on Windows. @Fidget-Spinner -- do you have advice for either of these? |
|
@ZeroIntensity JIT on Windows requires whatever is used in bytecodes.c to be an exported symbol. In this case it's complaining memcpy is not available. Are you using that? If so, you need to add the relevant header to template.c |
|
I didn't add anything that uses |
|
It could be indirectly used as well through an inlined function. In any case, unless string.h is included by Python.h or the other pycores by default it wont be included https://github.com/python/cpython/blob/main/Tools/jit/template.c |
This does a lot of refactoring to avoid repeated
_PyThreadState_GETcalls in hot code paths (primarily the eval loop + common object operations).Most of the changes here are mechanical, but I did have to make some more convoluted changes to make this robust (such as the addition of
_Py_DECREFand such).PyThreadState *parameter (almost) everywhere #132312