Closed Bug 804150 Opened 12 years ago Closed 12 years ago

[settings] lazy-load some parts of the settings app

Categories

(Firefox OS Graveyard :: Gaia, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ttaubert, Assigned: ttaubert)

References

Details

(Keywords: perf)

Attachments

(1 file)

The settings app is really sluggish to start. There's a lot of stuff loaded right at the beginning even though it might never or not yet be used.
Comment on attachment 673875 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/5934/files

An easy way to make the settings up start faster is to reduce unnecessary IO that isn't needed on startup. Subsections can be lazy-loaded when needed. The changes are:

1) The gaia commit hash is loaded right on start and issues an XHR request that reads from disk. This information is actually hidden behind two clicks and nothing a user would probably look for. Let's lazy-load it when its section is shown.

2) The list of applications contributes quite a lot to the long startup time. We should load it first when the user actually accesses this section. So that the user doesn't get confused by the blank screen I added a progress bar like the gallery and browser have.

I did some measurements and here are the results:

before: 6527ms
with [1]: 6544ms (no real change here but it probably doesn't hurt?)
with [2]: 4216ms

That's about 2.3s less time to startup and with the 4.2s left there's still a lot of room for improvement.
Attachment #673875 - Flags: review?(kaze)
Attachment #673875 - Flags: review?(21)
Makes sense to me. I started doing something very similar but you’ve been quicker. :-)
My only nitpick would be to add the specific CSS rules to `style/apps.css' instead of `style/settings.css'. R=me with this addressed.

FTR, I confirm loading the Gaia commit doesn’t make any difference. I’m doing the same for the new APN database and didn’t see much difference either.
Comment on attachment 673875 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/5934/files

Moved styles to apps.css. Updated style to match bug 796741.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): 
User impact if declined: Two seconds longer loading time for settings app.
Testing completed: 
Risk to taking this patch (and alternatives if risky): Small, self-contained patch. Low risk.
Attachment #673875 - Flags: review?(kaze)
Attachment #673875 - Flags: review?(21)
Attachment #673875 - Flags: review+
Attachment #673875 - Flags: approval-gaia-master?(21)
Blocks: 797395
(In reply to Tim Taubert [:ttaubert] from comment #2)
> 2) The list of applications contributes quite a lot to the long startup

Oh yes, navigator.mozApps is very slow, in particular the object wrapping.

> before: 6527ms
> with [1]: 6544ms (no real change here but it probably doesn't hurt?)
> with [2]: 4216ms
> 
> That's about 2.3s less time to startup and with the 4.2s left there's still
> a lot of room for improvement.

Nice work! How did you measure this?
The pull request seems to add a throbber, not reduce startup time. Please don't add a throbber. The improvements above are exactly the way to go. We should be able to get this under one second easily.
The PR reduces startup time *and* adds a throbber because the time it takes to load the apps list is now way more noticeable. I'll remove the throbber.

BTW, another huge bulk of the time is spent waiting on lock.onsuccess. The settings DB takes quite a lot of time to load.
Updated PR to contain performance fixes, only. Throbber has been removed.
Attachment #673875 - Flags: approval-gaia-master?(21) → approval-gaia-master+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Verified on the 11/12 otoro us build.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: