Allow parallel locale & polyfill loading #4188
mortargrind
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
Currently you have to load the polyfill first and then the respective locale data for that polyfill. Which results in unnecessary blocking calls and that results in longer wait times for network conditions where roundtrip time is high.
I believe this can be improved in a non-breaking way. For each locale, what we need to do is add an
else
block to the currentif
statement where we check the existence of the polyfill first.Basically if the polyfill is not present, but if an array under a special name (or a symbol to make it bullet-proof) exists, that the locale data just added to that array.
When the polyfill is loaded later, it can also check this array (again, if only it exists) and iterate over it and call the respective
__addLocaleData
function.The idea is prevent this happening:
In this screenshot both polyfill and locale data fetching took ~400ms, in total making it ~800ms. We could cut in half basically.
The resulting code would look like this:
In any locale data file:
In any polyfill file
Beta Was this translation helpful? Give feedback.
All reactions