René's URL Explorer Experiment


Title: gh-74690: Optimise `isinstance()` and `issubclass()` calls against runtime-checkable protocols by avoiding costly `super()` calls by AlexWaygood · Pull Request #112708 · python/cpython · GitHub

Open Graph Title: gh-74690: Optimise `isinstance()` and `issubclass()` calls against runtime-checkable protocols by avoiding costly `super()` calls by AlexWaygood · Pull Request #112708 · python/cpython

X Title: gh-74690: Optimise `isinstance()` and `issubclass()` calls against runtime-checkable protocols by avoiding costly `super()` calls by AlexWaygood · Pull Request #112708 · python/cpython

Description: Before: >python -m timeit -s "from typing import SupportsIndex" "isinstance(0, SupportsIndex)" Running PGUpdate|x64 interpreter... 1000000 loops, best of 5: 379 nsec per loop >python -m timeit -s ...

Open Graph Description: Before: >python -m timeit -s "from typing import SupportsIndex" "isinstance(0, SupportsIndex)" Running PGUpdate|x64 interpreter... 1000000 loops, best of 5: 379 nsec per loop...

X Description: Before: >python -m timeit -s "from typing import SupportsIndex" "isinstance(0, SupportsIndex)" Running PGUpdate|x64 interpreter... 1000000 loops, best of ...

Opengraph URL: https://github.com/python/cpython/pull/112708

X: @github

direct link

Domain: github.com

route-pattern/_view_fragments/voltron/pull_requests/show/:user_id/:repository/:id/pull_request_layout(.:format)
route-controllervoltron_pull_requests_fragments
route-actionpull_request_layout
fetch-noncev2:92cb23cc-2653-9d7e-d171-d1bab9ba069b
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id80D2:31EA40:3994C6:4D31EC:6969D667
html-safe-nonce9432a7625cbbbac7558d3c0cf0dc848398ae240582259fb92ffb3a1f0161a003
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEQyOjMxRUE0MDozOTk0QzY6NEQzMUVDOjY5NjlENjY3IiwidmlzaXRvcl9pZCI6IjE1NDI2OTYwMjQ3Nzk5MDQ2MTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb8085a93d89919a902870470ccf8a66185e9a731a0a4fdb568fc7086320224af
hovercard-subject-tagpull_request:1628397618
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/pull_requests_fragments/pull_request_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/voltron/pull_requests/show/python/cpython/112708/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/78cb826174e5ed0b8b5744966759309fbc564aafc56f83a919b15b2f30102a69/python/cpython/pull/112708
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/78cb826174e5ed0b8b5744966759309fbc564aafc56f83a919b15b2f30102a69/python/cpython/pull/112708
og:image:altBefore: >python -m timeit -s "from typing import SupportsIndex" "isinstance(0, SupportsIndex)" Running PGUpdate|x64 interpreter... 1000000 loops, best of 5: 379 nsec per loop...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAlexWaygood
hostnamegithub.com
expected-hostnamegithub.com
Noneacedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release83c08c21cdda978090dc44364b71aa5bc6dcea79
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/112708#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F112708
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F112708
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fpull_requests_fragments%2Fpull_request_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/112708
Reloadhttps://github.com/python/cpython/pull/112708
Reloadhttps://github.com/python/cpython/pull/112708
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/112708
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/112708
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
Jump to bottomhttps://github.com/python/cpython/pull/112708#issue-comment-box
AlexWaygoodhttps://github.com/AlexWaygood
python:mainhttps://github.com/python/cpython/tree/main
AlexWaygood:protocol-costly-super-callshttps://github.com/AlexWaygood/cpython/tree/protocol-costly-super-calls
gh-74690: Optimise isinstance() and issubclass() calls against runtime-checkable protocols by avoiding costly super() calls https://github.com/python/cpython/pull/112708#top
AlexWaygoodhttps://github.com/AlexWaygood
python:mainhttps://github.com/python/cpython/tree/main
AlexWaygood:protocol-costly-super-callshttps://github.com/AlexWaygood/cpython/tree/protocol-costly-super-calls
Conversation 2 https://github.com/python/cpython/pull/112708
Commits 3 https://github.com/python/cpython/pull/112708/commits
Checks 0 https://github.com/python/cpython/pull/112708/checks
Files changed https://github.com/python/cpython/pull/112708/files
Please reload this pagehttps://github.com/python/cpython/pull/112708
https://github.co/hiddenchars
https://github.com/python/cpython/pull/{{ revealButtonHref }}
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
Dec 4, 2023https://github.com/python/cpython/pull/112708#issue-2023963096
Please reload this pagehttps://github.com/python/cpython/pull/112708
Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance #74690https://github.com/python/cpython/issues/74690
Please reload this pagehttps://github.com/python/cpython/pull/112708
https://github.com/AlexWaygood
pythongh-74690https://github.com/python/cpython/issues/74690
: Optimisehttps://github.com/python/cpython/pull/112708/commits/ec4051ad0bb9284a27d47a55ef8153ad35541d34
isinstance()https://github.com/python/cpython/pull/112708/commits/ec4051ad0bb9284a27d47a55ef8153ad35541d34
andhttps://github.com/python/cpython/pull/112708/commits/ec4051ad0bb9284a27d47a55ef8153ad35541d34
issubclass()https://github.com/python/cpython/pull/112708/commits/ec4051ad0bb9284a27d47a55ef8153ad35541d34
calls agai…https://github.com/python/cpython/pull/112708/commits/ec4051ad0bb9284a27d47a55ef8153ad35541d34
ec4051ahttps://github.com/python/cpython/pull/112708/commits/ec4051ad0bb9284a27d47a55ef8153ad35541d34
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
performance https://github.com/python/cpython/issues?q=state%3Aopen%20label%3Aperformance
Dec 4, 2023https://github.com/python/cpython/pull/112708#event-11139773319
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
carljmhttps://github.com/carljm
December 4, 2023 14:17https://github.com/python/cpython/pull/112708#event-11139773366
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
JelleZijlstrahttps://github.com/JelleZijlstra
code ownerhttps://github.com/python/cpython/blob/9560e0d6d7a316341939b4016e47e03bd5bf17c3/.github/CODEOWNERS#L161
December 4, 2023 14:17https://github.com/python/cpython/pull/112708#event-11139773560
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting core review https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20core%20review%22
Dec 4, 2023https://github.com/python/cpython/pull/112708#event-11139774513
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
Dec 4, 2023 https://github.com/python/cpython/pull/112708#ref-issue-1198974045
Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance #74690 https://github.com/python/cpython/issues/74690
AlexWaygoodhttps://github.com/AlexWaygood
December 4, 2023 14:18https://github.com/python/cpython/pull/112708#commits-pushed-ff333fd
https://github.com/AlexWaygood
fix NEWShttps://github.com/python/cpython/pull/112708/commits/ff333fd83617f574ca09571786f40a2ccc8fbbee
ff333fdhttps://github.com/python/cpython/pull/112708/commits/ff333fd83617f574ca09571786f40a2ccc8fbbee
https://github.com/AlexWaygood
actually fix NEWShttps://github.com/python/cpython/pull/112708/commits/a7d76f6d6644acc2a7d0c1a16909be442b0c9930
a7d76f6https://github.com/python/cpython/pull/112708/commits/a7d76f6d6644acc2a7d0c1a16909be442b0c9930
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
Dec 4, 2023https://github.com/python/cpython/pull/112708#issuecomment-1838741744
Please reload this pagehttps://github.com/python/cpython/pull/112708
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
topic-typing https://github.com/python/cpython/issues?q=state%3Aopen%20label%3Atopic-typing
Dec 4, 2023https://github.com/python/cpython/pull/112708#event-11139854094
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
Dec 4, 2023 https://github.com/python/cpython/pull/112708#pullrequestreview-1762720757
View reviewed changes https://github.com/python/cpython/pull/112708/files/a7d76f6d6644acc2a7d0c1a16909be442b0c9930
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting merge https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20merge%22
awaiting core review https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20core%20review%22
Dec 4, 2023https://github.com/python/cpython/pull/112708#event-11140723835
https://github.com/carljm
carljmhttps://github.com/carljm
Dec 4, 2023 https://github.com/python/cpython/pull/112708#pullrequestreview-1762733897
View reviewed changes https://github.com/python/cpython/pull/112708/files/a7d76f6d6644acc2a7d0c1a16909be442b0c9930
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
c718ab9https://github.com/python/cpython/commit/c718ab92a584fa658b6a626a744f5a71a048b47c
Dec 4, 2023https://github.com/python/cpython/pull/112708#event-11140944874
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
December 4, 2023 15:41https://github.com/python/cpython/pull/112708#event-11140945116
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting merge https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20merge%22
Dec 4, 2023https://github.com/python/cpython/pull/112708#event-11140945718
aiskhttps://github.com/aisk
Feb 11, 2024 https://github.com/python/cpython/pull/112708#ref-commit-78c8faf
https://github.com/AlexWaygood
https://github.com/aisk
pythongh-74690https://github.com/python/cpython/issues/74690
: Optimisehttps://github.com/aisk/cpython/commit/78c8faf329094f2b0d15f7c140c5e48e1df3715f
isinstance()https://github.com/aisk/cpython/commit/78c8faf329094f2b0d15f7c140c5e48e1df3715f
andhttps://github.com/aisk/cpython/commit/78c8faf329094f2b0d15f7c140c5e48e1df3715f
issubclass()https://github.com/aisk/cpython/commit/78c8faf329094f2b0d15f7c140c5e48e1df3715f
calls agai…https://github.com/aisk/cpython/commit/78c8faf329094f2b0d15f7c140c5e48e1df3715f
78c8fafhttps://github.com/aisk/cpython/commit/78c8faf329094f2b0d15f7c140c5e48e1df3715f
python#112708https://github.com/python/cpython/pull/112708
https://github.com/namka279
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F112708
Glyphackhttps://github.com/Glyphack
Sep 2, 2024 https://github.com/python/cpython/pull/112708#ref-commit-cb075b6
https://github.com/AlexWaygood
https://github.com/Glyphack
pythongh-74690https://github.com/python/cpython/issues/74690
: Optimisehttps://github.com/Glyphack/cpython/commit/cb075b685fa35423d6d1d377950750219dee8c3b
isinstance()https://github.com/Glyphack/cpython/commit/cb075b685fa35423d6d1d377950750219dee8c3b
andhttps://github.com/Glyphack/cpython/commit/cb075b685fa35423d6d1d377950750219dee8c3b
issubclass()https://github.com/Glyphack/cpython/commit/cb075b685fa35423d6d1d377950750219dee8c3b
calls agai…https://github.com/Glyphack/cpython/commit/cb075b685fa35423d6d1d377950750219dee8c3b
cb075b6https://github.com/Glyphack/cpython/commit/cb075b685fa35423d6d1d377950750219dee8c3b
python#112708https://github.com/python/cpython/pull/112708
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F112708
https://github.com/carljm
carljm https://github.com/carljm
https://github.com/python/cpython/pull/112708/files/a7d76f6d6644acc2a7d0c1a16909be442b0c9930
https://github.com/JelleZijlstra
JelleZijlstra https://github.com/JelleZijlstra
https://github.com/python/cpython/pull/112708/files/a7d76f6d6644acc2a7d0c1a16909be442b0c9930
performance https://github.com/python/cpython/issues?q=state%3Aopen%20label%3Aperformance
topic-typing https://github.com/python/cpython/issues?q=state%3Aopen%20label%3Atopic-typing
Please reload this pagehttps://github.com/python/cpython/pull/112708
https://github.com/AlexWaygood
https://github.com/namka279
https://github.com/carljm
https://github.com/JelleZijlstra
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.