-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
[I18n] Google page speed - reduce execution time? #815
Comments
Also, I must say that when we specify one language - everything works well, but, unfortunately , we do not have one language, we have a lot of languages. Each translation has a size from 13 to 16 KB. List of languages (95)
Nuxt.config.js
|
This is interesting but I'm not sure why that measurement by Lighthouse is so slow and if it makes sense. I'm also working with ~12KB JSON translation files and I'm seeing some ridiculously bad times in lighthouse for it: That javascript file basically has a one
At least when it comes to the "script evaluation" (which is the bottleneck here), it shouldn't really matter much if it's in the main HTML (in a BTW. According to the Internet (or v8 engine), parsing JSON object (like happens here) should be more efficient than parsing a JS object - https://v8.dev/blog/cost-of-javascript-2019#json |
Alright, i found something, looks like the main problem is count of routes:
if i replace
to
the speed will increase hundreds of times. With 95 languages, nuxt generating 1995 routes. Do nuxt support thing like delayed loading routes, or something like that, for avoiding that? |
Large number of routes does affect performance, see #690 . But I'm not sure that's directly related to the lighthouse issue because in my project I don't have that many translations nor routes (18 translations and 11 routes in total since I'm using no-prefix strategy). |
I left only 2 locales, and run lighthouse several times, and got 60/80% on mobile, but when i make some changes in Namely, adding JSON right to DOM, for avoid unnecessary ajax request
And get it in
The performance has increased, to 90/95 for mobile, for web sometimes i get 100. |
I've tried that. It has improved performance by a few points only (from 48 to 52 or so). And as expected, the "Script Evaluation" time that was attributed to the lang file has now moved to the To conclude:
BTW. I don't want the solution that is based on the store to be the main one. This core functionality of this module should be functional even without the store. |
Exactly! But, in which repository should we create an issue for that idea? Nuxt, Vue-router? |
Maybe a good use case for user timings? That way it's easy to find how long https://web.dev/user-timings/ |
It's this module that is responsible for loading lang files. And I can use this issue to fix it. |
Sounds good. |
Nuxt is in the best position to do that itself. So it would make sense to create a feature request for Nuxt, if there isn't one already. |
@koteezy Thanks for your suggestion from #815 (comment) . I have initially mistaken it as using store but |
With v6.13.3 there should be no extra network requests to fetch the languages on initial load. I don't think it will make a big improvement but it's a good step. Since those were the issues mentioned in here, I think this can be closed now. |
There is already an issue #690 for that so we don't need to keep a separate one.
No, the issue is with initializing VueRouter with a large number of routes. It's an issue that affects both server and client performance. It's a fundamental issue in VueRouter and I'm not planning on doing any hacky workarounds for it. |
Got it. Thanks anyway! |
Hi. Google says that the script for loading languages on mobile devices is very slow. 1.5 seconds, while the main application is 400ms, how i can fix that?
In General, why not add an option that will add JSON with translations inside the HTML page, similar to ExtractCss.
The text was updated successfully, but these errors were encountered: