[issue30505] Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance

2017-06-02 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Thanks for reporting! The runtime implementation of protocol classes will be thoroughly reworked as a part of PEP 544, see also https://github.com/python/typing/pull/417 for a proof of concept runtime implementation. Also, there is another ongoing

[issue30505] Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance

2017-05-29 Thread Oren Ben-Kiki
New submission from Oren Ben-Kiki: In 3.6.0, invocation of isinstance calls typing._ProtocolMeta._get_protocol_attrs. This creates a set of all attributes in all base classes, loops on these attributes to check they exist, and discards the set. It is very slow. My program uses isinstance to