This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients gregory.p.smith
Date 2019-11-01.01:12:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572570768.69.0.355804772721.issue38659@roundup.psfhosted.org>
In-reply-to
Content
Creating an enum subclass (ie: defining an enum) is slow.  This dramatically impacts startup time of Python programs that import a bunch of potentially needed constant definitions at startup before any proper code executes.

How slow?  So slow that a module defining a ~300 enums takes nearly 100ms just to import from its pyc file.

Example code: https://github.com/googleads/google-ads-python/blob/96fd08bb62435f1930df4871033ba8689333b67f/google/ads/google_ads/v2/services/enums.py

We've known this, we should do something about it.  (Even if it means implementing the guts of the magic enum machinery in C.)  ie, it came up in https://bugs.python.org/issue28637 as a stdlib startup time regression and is likely to come up in similar contexts elsewhere.
History
Date User Action Args
2019-11-01 01:12:48gregory.p.smithsetrecipients: + gregory.p.smith
2019-11-01 01:12:48gregory.p.smithsetmessageid: <1572570768.69.0.355804772721.issue38659@roundup.psfhosted.org>
2019-11-01 01:12:48gregory.p.smithlinkissue38659 messages
2019-11-01 01:12:48gregory.p.smithcreate