Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

akx
Copy link
Member

@akx akx commented Dec 29, 2015

Refs #31

@codecov-io
Copy link

Current coverage is 83.48%

Merging #305 into master will decrease coverage by -0.78% as of 0040a4b

@@            master    #305   diff @@
======================================
  Files           22      23     +1
  Stmts         3776    3809    +33
  Branches         0       0       
  Methods          0       0       
======================================
- Hit           3182    3180     -2
  Partial          0       0       
- Missed         594     629    +35

Review entire Coverage Diff as of 0040a4b

Powered by Codecov. Updated on successful CI builds.

etanol and others added 5 commits January 4, 2016 23:19
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.
@etanol
Copy link
Contributor

etanol commented Jan 7, 2016

Looks good. Although I can't risk my neck over the Memoized meta class, since I have played very little with them.

@akx akx mentioned this pull request Jan 12, 2016
@akx
Copy link
Member Author

akx commented Jan 22, 2016

@mitsuhiko: Would you have time to give this a look? :)


class Memoized(type):
"""
Metaclass for memoization based on __init__ args/kwargs.
Copy link
Contributor

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.

@akx akx added this to the Babel 3 milestone Apr 25, 2016
@akx
Copy link
Member Author

akx commented Apr 25, 2016

This will probably need some rethinking wrt fuzzy locale support...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants