You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
localedata.locale_identifiers reads the available locale identifiers from disk every time it is called. Since the locale data files are distributed with the lib, there shouldn't be a need to scan the disk every time this is called, as it could be cached.
I noticed a hot spot in this method when profiling a service that uses this library. Specifically I noticed that babel.Locale.parse performs very poorly when supplied bogus locales. I ran a small benchmark to demonstrate this:
Could this information be built up in scripts/import_cldr.py and written to the global.dat file? Then the data could be quickly loaded as needed in localedata.py.
The text was updated successfully, but these errors were encountered:
akx
added a commit
to akx/babel
that referenced
this issue
May 27, 2019
localedata.locale_identifiers is slow
localedata.locale_identifiers
reads the available locale identifiers from disk every time it is called. Since the locale data files are distributed with the lib, there shouldn't be a need to scan the disk every time this is called, as it could be cached.I noticed a hot spot in this method when profiling a service that uses this library. Specifically I noticed that babel.Locale.parse performs very poorly when supplied bogus locales. I ran a small benchmark to demonstrate this:
Steps to Reproduce
Actual Results
Above snippet takes several seconds to execute.
Output on my machine:
Expected Results
Should be much faster.
Reproducibility
100%
Additional Information:
Could this information be built up in
scripts/import_cldr.py
and written to theglobal.dat
file? Then the data could be quickly loaded as needed inlocaledata.py
.The text was updated successfully, but these errors were encountered: