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

Add per locale Intl memoizer #504

Open
wants to merge 1 commit into
base: master
from
Open

Conversation

@Demivan
Copy link

@Demivan Demivan commented Jul 17, 2020

This allows multiple bundles with same locale to share Intl cache

@@ -0,0 +1,14 @@
type IntlCache = WeakMap<object, Record<string, object>>;

This comment has been minimized.

@macabeus

macabeus Jul 17, 2020
Contributor

Just a question: why is better to use a WeakMap here instead of just a plain object?

This comment has been minimized.

@Demivan

Demivan Jul 17, 2020
Author

I don't know :) Kept it as it is right now.
Seeing that map keys are Intl.NumberFormat and Intl.DateTimeFormat and will not be garbage collected it should be regular Map instead

This comment has been minimized.

@stasm

stasm Jul 30, 2020
Contributor

That's a good point. @zbraniecki, do you remember why we went with a WeakMap here?

This comment has been minimized.

@Pike

Pike Jul 30, 2020
Contributor

I didn't fully finish my doodling, but it seems that the keys are objects and not strings?

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

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.