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
In #217 I'm proposing an FTLResource class to store parsed FTL resources.
Another vector of cleaning up the role of MessageContext as a immutable container is to avoid duplication of intl memoization between multiple contexts.
Currently, if we create one context for ["res1.ftl", "res2.ftl"] and one context for ["res2.ftl", "res3.ftl"], we'll get two storages of intl objects. In the scenario Firefox operates in, that redundancy is not necessary, and adds a cost to dynamic recreation of contexts when the list of resources changes.
I'd like to suggest an optional external memoization model which could be shared across MessageContext instances:
In this model, invalidating ctx1 when res3.ftl is added is very cheap.
In the example above I even folded addMessages/loadResource into the constructor, but if you prefer to keep it as a separate method, it would work the same way.
In #217 I'm proposing an
FTLResource
class to store parsed FTL resources.Another vector of cleaning up the role of
MessageContext
as a immutable container is to avoid duplication of intl memoization between multiple contexts.Currently, if we create one context for
["res1.ftl", "res2.ftl"]
and one context for["res2.ftl", "res3.ftl"]
, we'll get two storages of intl objects. In the scenario Firefox operates in, that redundancy is not necessary, and adds a cost to dynamic recreation of contexts when the list of resources changes.I'd like to suggest an optional external memoization model which could be shared across
MessageContext
instances:In this model, invalidating
ctx1
whenres3.ftl
is added is very cheap.In the example above I even folded
addMessages/loadResource
into the constructor, but if you prefer to keep it as a separate method, it would work the same way.@stasm, @Pike - thoughts?
The text was updated successfully, but these errors were encountered: