mozilla-b2g/gaia — pull request #9443 by jrburke (2013-04-29 03:39:42+00:00)
Title: Bug 864414: email: Front-load main-frame-setup and use new recvCache

Introduces a cache of messages from back end, stored in a cookie to speed up initial render. With this change:

* Removes extra files from being loaded for back end on main thread, now just main-frame-setup, since it creates MailAPI synchronously now, with the cache data at first.
* Tested upgrading from maste with this change: user sees a brief flash of the New Account screen on first upgrade, but then changes over to message list once accounts are really detected. From then on, the new cache is used for faster speed up.
* Also tested two accounts configured (one imap, one activesync). Cache works correctly. The back end seems to change the order they are listed in the account splice on second reboot. The cache updates to match.

This change shaves a bit more than a second off the time to see message list.

I tried another experimental change where the message list card is not rendered at all until first messages, and about another 200-300ms are saved (currently we hit the messge list card 2-3 times on app boot up). However, it means a longer visible "white page" flash, so opted not to do that for this patch. Hopefully [Bug 863499](https://bugzilla.mozilla.org/show_bug.cgi?id=863499) lands some load event delay mechanism so that the screensot can be held a bit longer, and with that, we could pick up the extra gain since the white flash will be hidden by the app screenshot.

This change will increase the "time to load" number tracked in datazilla by a bit though. However, since that measurement was a bit misleading anyway for the mail app (user would not see messages until a good time after that number), I believe the tradeoff is worth it. If a solution for 863499 lands, then it would be possible to use that to get a better measurement of when the app is actually usable.Use cookie-based cache of back end messages from worker to speed up initial render of message list.

Includes the change from GELAM patch:
https://github.com/mozilla-b2g/gaia-email-libs-and-more/pull/190