FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-124153: Remove `_PyType_GetModuleByDef2` private function by neonene · Pull Request #124261 · python/cpython · GitHub

/ cpython Public

gh-124153: Remove _PyType_GetModuleByDef2 private function - #124261

Merged
encukou merged 8 commits into
python:mainfrom
neonene:usetoken
Sep 26, 2024
Merged

gh-124153: Remove _PyType_GetModuleByDef2 private function#124261
encukou merged 8 commits into
python:mainfrom
neonene:usetoken

Conversation

neonene commented Sep 20, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Unlike PyType_GetModuleByDef(), this uses PyType_HasFeature() for differentiation.
This will not be inlined, but hopefully 4% faster on Windows PGO.  The forceinline version was less efficient (2% faster).
Comment thread Objects/typeobject.c Outdated
PyType_GetModuleByDef() is now slower.

This comment was marked as outdated.

This comment was marked as outdated.

encukou commented Sep 24, 2024

Copy link
Copy Markdown
Member

Looks like this removes the only call to _PyType_GetModuleByDef2; could you also remove the function?

Copy link
Copy Markdown
Member

Looks like this removes the only call to _PyType_GetModuleByDef2; could you also remove the function?

@neonene prepared #124262 but this follow-up PR cannot be merged before the code is updated to no longer call _PyType_GetModuleByDef2 ;-)

neonene commented Sep 24, 2024

Copy link
Copy Markdown
Contributor Author

@neonene prepared #124262 but this follow-up PR cannot be merged before the code is updated to no longer call _PyType_GetModuleByDef2 ;-)

I've port the header update from #124262 to here. Is this what you mean?

Copy link
Copy Markdown
Member

Why not removing _PyType_GetModuleByDef2() body as well?

neonene changed the title gh-124153: Use Py_tp_token slot and PyType_GetBaseByToken() in a few modules gh-124153: Remove _PyType_GetModuleByDef2 private function Sep 24, 2024

neonene commented Sep 25, 2024

Copy link
Copy Markdown
Contributor Author

(Does it really make sense to remove _PyType_GetModuleByDef2() before checking the features on main?)

encukou commented Sep 25, 2024

Copy link
Copy Markdown
Member

To be honest I don't follow too closely the order in which the changes here should be made/merged.
I also have no way to benchmark with MSVC, so I trust you about the performance, and just review for functionality and readability :)

If this removes the last call to _PyType_GetModuleByDef2, and we don't plan to bring the function back, then it should be removed now. If it turns out to be needed again, we can find it in Git history.

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

encukou merged commit d7248cd into python:main Sep 26, 2024
neonene deleted the usetoken branch September 26, 2024 16:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL