-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dramatic import performance regression in Python 3.12+ when debugging #294
Comments
Can you give a minimal repro scenario?
If this is only happening in Python 3.12+, and the relevant code in the library hasn't changed for over 10 years, it's probably not that debatable. |
My bad, the repro was in the linked issue. I've updated the issue description.
Obviously this is a huge performance regression in CPython that is being actively being worked on. Hopefully there is a substantial improvement in 3.13 or even 3.14. That said, given the need to support the new At the very least, having an issue open benefits libphonenumber users who discover this problem that is affecting their import speed and want to track its status. |
Thanks. It seems like the slow-down only occurs on single stepping with
Makes sense, I'll leave this open. |
Python 3.12+ has a major performance regression when debugging, which affects this library (latest version, 8.13.34) particularly badly:
python/cpython#107674
Repro of issue:
It takes multiple minutes to import the
geocoder
module in Python 3.12 and 3.13 when debugging due to the interpreter having to construct many very large dictionaries. This makes it impractical to run the debugger on projects that use this library under newer Python versions.It's debatable whether this is an interpreter issue or a library issue, but the problem could be worked around by loading these large dicts from JSON files instead of importing them as Python files, as this would utilize the fast C-based JSON parser. Or these large dictionaries could be loaded as needed at runtime instead of all at once at import time.
The text was updated successfully, but these errors were encountered: