Title: `PyType_GetModuleByDef` is really slow. · Issue #119663 · python/cpython · GitHub
Open Graph Title: `PyType_GetModuleByDef` is really slow. · Issue #119663 · python/cpython
X Title: `PyType_GetModuleByDef` is really slow. · Issue #119663 · python/cpython
Description: PyType_GetModuleByDef does a lot of work for what was a single memory read prior to sub-interpreters. For example, #114682. We should provide a more efficient way to get to the module state from the module def. AFAICT, the function to ge...
Open Graph Description: PyType_GetModuleByDef does a lot of work for what was a single memory read prior to sub-interpreters. For example, #114682. We should provide a more efficient way to get to the module state from th...
X Description: PyType_GetModuleByDef does a lot of work for what was a single memory read prior to sub-interpreters. For example, #114682. We should provide a more efficient way to get to the module state from th...
Opengraph URL: https://github.com/python/cpython/issues/119663
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`PyType_GetModuleByDef` is really slow.","articleBody":"`PyType_GetModuleByDef` does a lot of work for what was a single memory read prior to sub-interpreters.\r\n\r\nFor example, https://github.com/python/cpython/issues/114682.\r\n\r\nWe should provide a more efficient way to get to the module state from the module def.\r\n\r\nAFAICT, the function to get the module state is a pure function of the interpreter and the module def.\r\nSince the module def already has a `m_index` field that is described as \"The module's index into its interpreter's modules_by_index cache.\", then a `Py_GetModuleFromDef()` function could be as simple as:\r\n\r\n```C\r\ninline PyObject *\r\nPy_GetModuleFromDef(PyModuleDef *def)\r\n{\r\n return PyInterpreterState_Get()-\u003emodules_table[def-\u003em_base.m_index];\r\n}\r\n```\r\n","author":{"url":"https://github.com/markshannon","@type":"Person","name":"markshannon"},"datePublished":"2024-05-28T15:23:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/119663/cpython/issues/119663"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:de7e84b4-6b29-ed35-c62d-9e1b467182d3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2B8:70D8F:2F007:41D64:696A3C49 |
| html-safe-nonce | ddc0be88a3d63f273f8d07dbc7fd2b50390f1b82293024ee3e672bc679cd443e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkI4OjcwRDhGOjJGMDA3OjQxRDY0OjY5NkEzQzQ5IiwidmlzaXRvcl9pZCI6IjcxOTQzNTI3MjgzMzc0MzE2MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ac1b226582d8501a59ae0e735ce46ca1ae333fa150a9348e89d281b220719f8c |
| hovercard-subject-tag | issue:2321360775 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/119663/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9a407b062d3ac5bf74f204338106ad4e5d3ad6ee016e87789c4402c6c5de5cfc/python/cpython/issues/119663 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9a407b062d3ac5bf74f204338106ad4e5d3ad6ee016e87789c4402c6c5de5cfc/python/cpython/issues/119663 |
| og:image:alt | PyType_GetModuleByDef does a lot of work for what was a single memory read prior to sub-interpreters. For example, #114682. We should provide a more efficient way to get to the module state from th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | markshannon |
| hostname | github.com |
| expected-hostname | github.com |
| None | 321736bfdb3f591415ae895a0459bec204b26a76caf47ba5c980634cfacc4538 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 13581a31d51edf4a3aca179e10890a4d4f9b6d76 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width