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 "from typing import SupportsIndex" "issubclass(int, SupportsIndex)" Running PGUpdate|x64 interpreter... 500000 loops, best of 5: 592 nsec per loop After: >python -m timeit -s "from typing import SupportsIndex" "isinstance(0, SupportsIndex)" Running PGUpdate|x64 interpreter... 1000000 loops, best of 5: 298 nsec per loop >python -m timeit -s "from typing import SupportsIndex" "issubclass(int, SupportsIndex)" Running PGUpdate|x64 interpreter... 500000 loops, best of 5: 523 nsec per loop Timings done using a fresh PGO-optimised build on Windows with the main branch. Issue: gh-74690
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
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:57c825f0-bf47-a257-4877-688e8e24e931 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | E554:200E33:283356:38801F:696A072F |
| html-safe-nonce | 1090716401216a8a3bb824f82e674e7f30cd9e6db65ec472775dd477dabd827f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTU0OjIwMEUzMzoyODMzNTY6Mzg4MDFGOjY5NkEwNzJGIiwidmlzaXRvcl9pZCI6IjI4ODc0OTE4NTE4NTEwMDc3OTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6f5136dc69ee3096405cb54811297c08b849332fc5e5cc676c1d66837dea2399 |
| hovercard-subject-tag | pull_request:1628397618 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/python/cpython/pull/112708/checks |
| twitter:image | https://avatars.githubusercontent.com/u/66076021?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/66076021?s=400&v=4 |
| og:image:alt | 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... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 578c119ff0247c8b2f2491fbf4fc0395cdf909d4df66598cebdc96ddfc4418dc |
| 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 full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 671c2f67171dbced24284331f3133a613d08c366 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width