mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
126 stars 41 forks source link

Fetch the locale bundle in parallel with the main JS bundle #2092

Open rik opened 3 years ago

rik commented 3 years ago

The locale bundle is fetched when require(`bundle-loader?name=[name]-i18n-[folder]!../../locale/${locale}/amo.js`) is executed. React.render happens after that file has been fetched and executed. Therefore it would be a good thing to fetch it in parallel rather than serially.

Example: https://www.webpagetest.org/result/210519_AiDc9W_6e4156e19a28284241d6cac7ce14177d/3/details/ waterfall

Advantages

Sooner here is in the order of one round trip to the CDN (which can be far in Asia, Africa and South America).

Drawbacks

Other

https://github.com/mozilla/addons/issues/12325 would also have the same advantages listed here.

┆Issue is synchronized with this Jira Task

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this bug should stay open, please comment on the issue with further details. Thank you for your contributions.

bobsilverberg commented 2 years ago

@diox Do you have any thoughts about whether we should keep this on our backlog?

diox commented 2 years ago

I don't think we have the bandwidth to deal with this right now.

Also, I suspect that if we wanted to make locale bundle fetching faster, it would be easier for us to try to reduce bundle size instead, either the main one or the locale specific ones. For instance switching to a different format that doesn't force us to have the full english strings as the keys would help quite a bit.

ziir commented 2 years ago

What about <link rel=prefetch> the locale bundle instead? Should give the browser a slight head start in loading the bundle with a low priority, requires no other changes & wouldn't impact existing bundle loading/execution priorities & order.

KevinMind commented 5 months ago

Old Jira Ticket: https://mozilla-hub.atlassian.net/browse/ADDFRNT-8