Repository navigation
bpo-31336: Speed up type creation, which is highly dominated by slow dict lookups. #3279
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0a865c9
Speed up type creation, which is highly dominated by slow dict lookups.
c4779e3
Update comment after changing the function call that it refers to.
ff2ea63
Ignore any errors (however unlikely) that may happen during the mro c…
76b1986
Extract non-caching code from _PyType_Lookup() to use it directly fro…
6f98485
Avoid some useless overhead for the no-basetype case. If "object" eve…
d9b726e
Add comment.
be15255
Avoid uselessly searching empty bases for a metaclass. This is quite …
0736226
Avoid unsafe handling of borrowed "mro" reference during hash() call.
8bc783f
Clean up code and formatting a little.
66648dd
Add braces for code style reasons.
85fb3ae
Give internal helper function a local name that does not resemble (ex…
09e716a
Allow non-dict types for the class dict when looking up names and cal…
1d52082
Lazily calculate name hash in find_name_in_mro() to avoid potential r…
f09bfd3
Revert "Lazily calculate name hash in find_name_in_mro() to avoid pot…
824d7cb
Revert "Allow non-dict types for the class dict when looking up names…
5184191
add news entry for faster class creation
4efde8e
Change nice interface of "find_name_in_mro()" to evil interface eatin…
f5bce2a
Mention amount of speedup in News entry.
02bfef0
Revert "Change nice interface of "find_name_in_mro()" to evil interfa…
2497858
Guard against external live exceptions when calling find_name_in_mro(…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add braces for code style reasons.
- Loading branch information
There are no files selected for viewing
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyErr_Clear()always is called after_PyType_LookupUncached()iferror == -1. Why not call it inside_PyType_LookupUncached()?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is which interface is better: should the function itself always swallow any exceptions, or should the callers decide how to deal with them? The comments in the original
_PyType_Lookup()implementation suggest that others have already been as unhappy as me about the interface of that function, so why keep making people unhappy?