Uh oh!
There was an error while loading. Please reload this page.
gh-140795: Put the thread state in PyCriticalSection structs - #146066
gh-140795: Put the thread state in PyCriticalSection structs#146066encukou wants to merge 1 commit into
Conversation
pythonGH-141406 improved performance by only fetching thread state once and storing it in a variable on the stack. This instead puts the thread state in the PyCriticalState struct (also a temp variable on the stack), bringing the public and private implementations closer together.
colesbury
commented
Mar 17, 2026
I used Claude to benchmark the PR on Linux in a few cases (main executable, https://github.com/colesbury/gh-140795-benchmarks/blob/main/results.txt |
kumaraditya303
commented
Mar 18, 2026
The important part that this PR misses is that in my PR the thread state is passed in a register whereas here it will need to be loaded from stack, I don't see value in doing this unless the performance is atleast equal. |
encukou
commented
Mar 18, 2026
I see. In my (much more limited) testing this looked better. |
GH-141406 improved performance by only fetching thread state once and storing it in a variable on the stack.
This instead puts the thread state in the PyCriticalState struct (also a temp variable on the stack), bringing the public and private implementations closer together.