gh-74690: Improve performance when testing against protocols with many attributes. by randolf-scholz · Pull Request #112157 · python/cpython · GitHub

github.com

Tin mới

randolf-scholz:improve_protocol_isinstance_perf

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance #74690

added fast check in _ProtocolMeta.__instancecheck__

bedevere-app Bot commented Nov 16, 2023

bedevere-app Bot commented Nov 16, 2023

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

View reviewed changes

Learn more about hiding disruptive comments

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

python/typing#1363

getattr_static is just really slow (I re-ran the test, replacing it with plain getattr and got 11x speedup)

⌂git
1/1