[Python-Dev] Type creation speed (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Fri Dec 15 12:50:58 EST 2017
- Previous message (by thread): [Python-Dev] Accepting PEP 560 -- Core support for typing module and generic types
- Next message (by thread): [Python-Dev] Accepting PEP 560 -- Core support for typing module and generic types
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 15 Dec 2017 19🔞11 +0200 Serhiy Storchaka <storchaka at gmail.com> wrote:
15.12.17 18:36, Antoine Pitrou пише: > Do you have any general idea how to speed up class creation?
Some work was done in [https://bugs.python.org/issue31336]. Currently I have no ideas. Creating a class is 1-2 orders slower than creating a function. And adding parent classes significantly slows down it.
I made simple, approximate measurements with an empty class:
- fixup_slot_dispatchers() takes 78% of the time (!)
- build_class() takes 5%
- computing the default qualname, module, doc takes 3%
- set_names() takes 2.5%
- init_subclass() takes 2.5%
Regards
Antoine.
- Previous message (by thread): [Python-Dev] Accepting PEP 560 -- Core support for typing module and generic types
- Next message (by thread): [Python-Dev] Accepting PEP 560 -- Core support for typing module and generic types
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]