mozilla-b2g/gaia — pull request #20464 by jrburke (2014-06-12 23:20:05+00:00)
Title: Bug 837677 - [e-mail] Implement new startup loading events

Implements the startup events described here:

https://developer.mozilla.org/en-US/Apps/Build/Performance/Firefox_OS_app_responsiveness_guidelines

It can be tested locally on a flame device by running:

MARIONETTE_RUNNER_HOST=marionette-device-host APP=email make test-perf

I generated my test builds with this command:

make install-gaia GAIA_DEV_PIXELS_PER_PX=1.5 GAIA_OPTIMIZE=1 APP=email

Implementing these events is a bit more complicated by the HTML cookie cache, and I had to do a bit of extra work to make sure to only emit the events once, since the collection seemed to favor the last vs the first event of a given type for the final time recorded.

I also inlined the custom event work from performance_testing_helper.js in html_cache_restore.js, see the comments in html_cache_restore.js for why.

I opted to generate the moz-app-loaded final event after a complete load of the backend worker and reception of the account slice data for the accounts, which is fairly late, but gives us a good marker for the total cost of a the worker and a round trip of data.

Malformed JSON paste of times that were collected:

Without an account (Email FTU):

```
"passes": [
{
"title": "startup > moz-chrome-dom-loaded",
"fullTitle": "startup event test > email > startup > moz-chrome-dom-loaded",
"duration": 76837,
"mozPerfDurations": [
224.32458300000872,
744.5959890000013,
298.87494700000025,
240.39578100000108,
310.6262499999975
],
"mozPerfDurationsAverage": 363.76351000000176
},
{
"title": "startup > moz-app-visually-complete",
"fullTitle": "startup event test > email > startup > moz-app-visually-complete",
"duration": 76837,
"mozPerfDurations": [
225.28640700000688,
744.9126030000007,
299.3934369999988,
240.9975000000013,
311.36057299999993
],
"mozPerfDurationsAverage": 364.39010400000154
},
{
"title": "startup > moz-content-interactive",
"fullTitle": "startup event test > email > startup > moz-content-interactive",
"duration": 76837,
"mozPerfDurations": [
957.2794790000044,
1460.748020000001,
1398.1640619999998,
1391.5358849999993,
1047.684009999999
],
"mozPerfDurationsAverage": 1251.0822912000008
},
{
"title": "startup > moz-chrome-interactive",
"fullTitle": "startup event test > email > startup > moz-chrome-interactive",
"duration": 76837,
"mozPerfDurations": [
957.6970840000067,
1461.1032290000003,
1398.8662489999988,
1391.887396000002,
1048.0585409999985
],
"mozPerfDurationsAverage": 1251.5224998000012
},
{
"title": "startup > moz-app-loaded",
"fullTitle": "startup event test > email > startup > moz-app-loaded",
"duration": 76837,
"mozPerfDurations": [
1191.188958000006,
1702.594583,
1596.8138010000002,
1607.5775520000007,
1882.1182809999973
],
"mozPerfDurationsAverage": 1596.0586350000008
},
{
"title": "startup time ",
"fullTitle": "startup test > email > startup time ",
"duration": 80611,
"mozPerfDurations": [
546,
531,
475,
482,
513
],
"mozPerfDurationsAverage": 509.4,
```

With one account configured and messages already fetched:

```
"passes": [
{
"title": "startup > moz-chrome-dom-loaded",
"fullTitle": "startup event test > email > startup > moz-chrome-dom-loaded",
"duration": 78130,
"mozPerfDurations": [
332.96067700000276,
369.34093700000085,
346.67401000000245,
432.42333300000064,
393.89791700000023
],
"mozPerfDurationsAverage": 375.05937480000136
},
{
"title": "startup > moz-app-visually-complete",
"fullTitle": "startup event test > email > startup > moz-app-visually-complete",
"duration": 78130,
"mozPerfDurations": [
333.37786400000186,
369.8980730000003,
347.1454160000012,
434.17729099999997,
394.85281300000133
],
"mozPerfDurationsAverage": 375.89029140000093
},
{
"title": "startup > moz-content-interactive",
"fullTitle": "startup event test > email > startup > moz-content-interactive",
"duration": 78130,
"mozPerfDurations": [
1134.2292710000002,
1722.879374,
1498.8807810000017,
1520.0565619999998,
1597.597656
],
"mozPerfDurationsAverage": 1494.7287288000002
},
{
"title": "startup > moz-chrome-interactive",
"fullTitle": "startup event test > email > startup > moz-chrome-interactive",
"duration": 78130,
"mozPerfDurations": [
1134.5842190000003,
1723.3298430000013,
1499.245885000002,
1520.3983850000004,
1597.9224480000012
],
"mozPerfDurationsAverage": 1495.096156000001
},
{
"title": "startup > moz-app-loaded",
"fullTitle": "startup event test > email > startup > moz-app-loaded",
"duration": 78130,
"mozPerfDurations": [
3069.631978999998,
4166.218853,
3342.605520000001,
3761.483227999999,
3879.7354680000008
],
"mozPerfDurationsAverage": 3643.9350095999994
},
{
"title": "startup time ",
"fullTitle": "startup test > email > startup time ",
"duration": 79475,
"mozPerfDurations": [
790,
1246,
1139,
1342,
855
],
"mozPerfDurationsAverage": 1074.4,
```