Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] bpo-39465: Optimize _PyInterpreterState_GET() #20767

Closed
wants to merge 1 commit into from
Closed

[WIP] bpo-39465: Optimize _PyInterpreterState_GET() #20767

wants to merge 1 commit into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 9, 2020

  • Add _PyRuntimeState.gilstate.interp_current.

  • _PyThreadState_Swap() now sets interp_current.
    PyThreadState_Swap(NULL) sets interp_current to NULL.

  • Replace _PyThreadState_GET() with _PyInterpreterState_GET() in:

    • get_small_int()
    • gcmodule.c: add also get_gc_state() function
    • _PyTrash_deposit_object()
    • _PyTrash_destroy_chain()
    • warnings_get_state()
    • Py_GetRecursionLimit()

https://bugs.python.org/issue39465

@vstinner vstinner requested a review from pablogsal as a code owner June 9, 2020 21:58
@vstinner vstinner marked this pull request as draft June 9, 2020 23:46
@vstinner vstinner changed the title bpo-39465: Optimize _PyInterpreterState_GET() [WIP] bpo-39465: Optimize _PyInterpreterState_GET() Jun 9, 2020
@vstinner
Copy link
Member Author

vstinner commented Jun 9, 2020

I'm still working on measuring the optimization performance. So far, the benefit is not obvious.

* Add _PyRuntimeState.gilstate.interp_current.
* _PyThreadState_Swap() now sets interp_current.
  PyThreadState_Swap(NULL) sets interp_current to NULL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants