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
Make Locale objects immutable and cache them #305
base: master
Are you sure you want to change the base?
Conversation
Current coverage is
|
Get rid of the LocaleDataDict because it slows down key lookups compared to a native dict. To do that, we need to resolve the aliases when loading the locale data from disk. Since this data is later cached, we incur in a slight overhead for the initial load. However, this is well compensated during the rest of the process execution.
Looks good. Although I can't risk my neck over the |
@mitsuhiko: Would you have time to give this a look? :) |
|
||
class Memoized(type): | ||
""" | ||
Metaclass for memoization based on __init__ args/kwargs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably document that it assumes the constructor&initializer are pure since the cache-fetch is not locked, you could have two identical memoized instances being constructed.
This will probably need some rethinking wrt fuzzy locale support... |
Refs #31