summaryrefslogtreecommitdiffstats
path: root/Parser/pegen.c
diff options
context:
space:
mode:
authorCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-10-14 20:59:51 (GMT)
committerGitHub <noreply@github.com>2021-10-14 20:59:51 (GMT)
commitb2af211e229df941d9b404f69547a264115156b5 (patch)
tree7419794a48171aa351ce7ebb1510bcf6408b2cde /Parser/pegen.c
parent0bbea0723ee07f9d7ad9745f0e1875718ef38715 (diff)
downloadcpython-b2af211e229df941d9b404f69547a264115156b5.zip
cpython-b2af211e229df941d9b404f69547a264115156b5.tar.gz
cpython-b2af211e229df941d9b404f69547a264115156b5.tar.bz2
bpo-45417: [Enum] fix quadratic behavior during creation (GH-28907)
Creating an Enum exhibited quadratic behavior based on the number of members in three places: - `EnumDict._member_names`: a list searched with each new member's name - member creation: a `for` loop checking each existing member to see if new member was a duplicate - `auto()` values: a list of all previous values in enum was copied before being sent to `_generate_next_value()` Two of those issues have been resolved: - `_EnumDict._member_names` is now a dictionary so lookups are fast - member creation tries a fast value lookup before falling back to the slower `for` loop lookup The third issue still remains, as `_generate_next_value_()` can be user-overridden and could corrupt the last values list if it were not copied.
Diffstat (limited to 'Parser/pegen.c')
0 files changed, 0 insertions, 0 deletions