[issue38659] enum classes cause slow startup time

Armin Rigo report at bugs.python.org
Sat Oct 9 01:52:43 EDT 2021


Armin Rigo <arigo at users.sourceforge.net> added the comment:

Nobody seemed to mention it so I might as well: defining a regular Enum class takes an amount of time that is clearly quadratic in the number of attributes.  That means that the problem is not Python-versus-C or small speed-ups or adding secret APIs to do the simple case faster.  The problem is in the algorithm which needs to be fixed somewhere.  My timings:

number of attributes     time
1500                     0.24s
3000                     0.94s
6000                     3.74s
12000                    15.57s

----------
nosy: +arigo

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38659>
_______________________________________


More information about the Python-bugs-list mailing list