-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage
Description
There's a lot of code which accesses the current interpreter state especially under free-threading via PyInterpreterState_Get. Currently to lookup interpreter state first the thread state is accessed then read by ts->interp but it can be optimized to be stored in a thread local variable _Py_tss_current_interp so that it can be read directly.
Linked PRs
- gh-140544: cleanup
HAVE_THREAD_LOCALchecks in pystate.c #140547 - gh-140544: store pointer to interpreter state as a thread local for fast access #140573
- gh-140544: use faster
_PyInterpreterState_GETfor type lock #140584 - gh-140544: fix build for including
pycore_pystate.hwhenHAVE_THREAD_LOCALis not defined #140623 - gh-140544: Always assume that thread locals are available #140690
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage