Skip to content

Commit 2a9a234

Browse files
committed
Add comment about enum performance
1 parent d278130 commit 2a9a234

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

uid2_client/input_util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ def is_phone_number_normalized(phone_number):
2222
return min_phone_number_digits <= total_digits <= max_phone_number_digits
2323

2424

25+
# Accessing an enum member is ~3x slower than accessing a non-enum member in Python 3.11.
26+
# This was improved in Python 3.12 but there's still a performance overhead (~44% slower).
27+
# That's why this class isn't an enum.
28+
# https://github.com/python/cpython/issues/93910#issuecomment-1165503032
2529
class EmailParsingState:
2630
Starting = 1
2731
Pre = 2

0 commit comments

Comments
 (0)