Another set of ideas(probably for second evaluation)

NOTE:For system specs see here

Possibilties to improve ABCs

  1. My earlier post proposed for a C weakset(and its structurally complete) as a way to improve performance of ABCs(Abstract base classes) and it was discussed on core-mentorship ML.It was proposed that this might increase complexity and also would need a corresponding improvement in test suite.So it still needs to be discussed.

But Inada also made other suggestions to improve “ABCs”:

Heavy import times Eg case-> typing module:(py3 provides special syntax(->) so as to Third party packages(like mypy) can do type checks): He pointed out that this part of code is the most slow as text getattr(value, “isabstractmethod”, False) is called for all class attributes of ABCs (including subclass of ABCs).Now When the value is not abstractmethod, AttributeError is raised and cleared internally, getattr uses method cache (via PyType_Lookup), but __isabstractmethod__ is mostly in instance dict. So checking method cache is mostly useless efforts.”

  1. But Victor Stinner came up with the suggestion of stripping annotations(in specific example of typings module) in cached .pyc(this way annotations would remain in code(and static type checking could is unaffected) but not in cached files thus decreasing time.)

Also this could be done in harmony with fat optimizer project(see PEP 509,510,511).

About fat python: This project aims to provide compiler optimizations (like constant propagation,constant folding etc) when and where possible, This is ensured using guards(see PEP510).Presently there are quite a few things(the TODo list) that needs to be done in fat-python.I intend to take them up and that way I could expand to other benchmarks too.


Written on June 26, 2017