Closed Bug 811136 Opened 12 years ago Closed 10 years ago

l10n.js loadResource is causing multiple sync reflows

Categories

(Firefox OS Graveyard :: Gaia::L10n, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: Margaret, Unassigned)

References

Details

(Keywords: perf, Whiteboard: [c= p= s= u=])

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.

http://people.mozilla.com/~bgirard/cleopatra/#report=6f3e4afaa621941963a04001291bfa218a1e6702&filter=%255B%257B%2522type%2522%253A%2522RangeSampleFilter%2522%252C%2522start%2522%253A5046%252C%2522end%2522%253A5195%257D%252C%257B%2522type%2522%253A%2522RangeSampleFilter%2522%252C%2522start%2522%253A55%252C%2522end%2522%253A108%257D%255D&selection=%255B%2522Startup%253A%253AXRE_InitChildProcess%2522%252C%2522Input%253A%253AnsInputStreamPump%253A%253AOnInputStreamReady%2522%252C%2522Input%253A%253AnsInputStreamPump%253A%253AOnStateTransfer%2522%252C%2522content%253A%253AnsXMLHttpRequest%253A%253AOnStopRequest%2522%252C%2522nsEventDispatcher%253A%253ADispatch%2522%252C%2522js%253A%253ARunScript%2522%252C%2522parseResource%252FloadResource%252Fxhr.onreadystatechange%28%29%2520%2540%2520l10n.js%253A205%2522%252C%2522parseResource%252F%253C%28%29%2520%2540%2520l10n.js%253A222%2522%252C%2522parseProperties%28%29%2520%2540%2520l10n.js%253A136%2522%252C%2522parseRawLines%28%29%2520%2540%2520l10n.js%253A147%2522%252C%2522loadImport%28%29%2520%2540%2520l10n.js%253A187%2522%252C%2522loadResource%28%29%2520%2540%2520l10n.js%253A199%2522%252C%2522Input%253A%253AnsInputStreamPump%253A%253AOnInputStreamReady%2522%252C%2522Input%253A%253AnsInputStreamPump%253A%253AOnStateTransfer%2522%252C%2522content%253A%253AnsXMLHttpRequest%253A%253AOnStopRequest%2522%252C%2522nsEventDispatcher%253A%253ADispatch%2522%252C%2522js%253A%253ARunScript%2522%252C%2522parseResource%252FloadResource%252Fxhr.onreadystatechange%28%29%2520%2540%2520l10n.js%253A205%2522%252C%2522parseResource%252F%253C%28%29%2520%2540%2520l10n.js%253A222%2522%252C%2522parseProperties%28%29%2520%2540%2520l10n.js%253A136%2522%252C%2522parseRawLines%28%29%2520%2540%2520l10n.js%253A147%2522%252C%2522loadImport%28%29%2520%2540%2520l10n.js%253A187%2522%252C%2522loadResource%28%29%2520%2540%2520l10n.js%253A199%2522%252C%2522Timer%253A%253AFire%2522%252C%2522nsRefreshDriver%253A%253ANotify%2522%255D
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.
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
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)
(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.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(margaret.leibovic)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.