l10n.js loadResource is causing multiple sync reflows



6 years ago
5 years ago


(Reporter: Margaret, Unassigned)



Firefox Tracking Flags

(Not tracked)


(Whiteboard: [c= p= s= u=])



6 years ago
I noticed this in a profile of the settings app (this is a profile of master, not with any of my other patches applied). Hopefully we'll avoid going through this code path on app startup, but it would be good to investigate/improve it for the fallback case.


Comment 1

6 years ago
maybe this gets cheaper if we remove the original strings from the html? Or we at least get to this earlier by not having to compute lengths etc for the first round of strings.

Comment 2

6 years ago
The confusing thing is that it looks like these reflows are being triggered by different calls parseResource, and we should only be calling translateFragement once, after all of the different resources have been loaded. However, I'm by no means an expert at reading these profiles, so it could be interesting to try different changes and see what the profiler says. Like as a sanity check, we could get rid of the callback to translateFragment and see what happens.
No, this is a single parseResource, it's just nested because first parseResource parses .ini file that triggers loading for .properties files and then parsing of it. (that's synchronous).
Keywords: perf


5 years ago
Whiteboard: [c= p= s= u=]
Component: Gaia → Gaia::L10n
We refactored the whole l10n.js file which makes all I/O async (bug 914414), and also moved to a single .json (instead of .ini -> .properties).

Can you reproduce this bug on master?
Flags: needinfo?(margaret.leibovic)

Comment 5

5 years ago
(In reply to Zibi Braniecki [:gandalf] from comment #4)
> We refactored the whole l10n.js file which makes all I/O async (bug 914414),
> and also moved to a single .json (instead of .ini -> .properties).
> Can you reproduce this bug on master?

I have not built or run gaia in a very long time. I'm willing to bet this bug isn't relevant anymore.
Last Resolved: 5 years ago
Flags: needinfo?(margaret.leibovic)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.