8000 gh-74690: Optimise `isinstance()` and `issubclass()` calls against runtime-checkable protocols by avoiding costly `super()` calls by AlexWaygood · Pull Request #112708 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-74690: Optimise isinstance() and issubclass() calls against runtime-checkable protocols by avoiding costly super() calls #112708

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 3 commits into from
Dec 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
actually fix NEWS
  • Loading branch information
AlexWaygood authored Dec 4, 2023
commit a7d76f6d6644acc2a7d0c1a16909be442b0c9930
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Speedup :func:`isinstance` checks by roughly 20% for
:func:`runtime-checkable protocols <typing.runtime_checkable>`
that only have one callable member.
Speedup `issubclass()` checks for these protocols by roughly 10%.
Speedup :func:`issubclass` checks for these protocols by roughly 10%.
Patch by Alex Waygood.
0