Closed Bug 1110590 (AppStartup) Opened 10 years ago Closed 8 years ago

[meta] Improve application startup performance

Categories

(Firefox OS Graveyard :: Performance, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: ting, Assigned: bobby.chien+bugzilla)

References

Details

(Keywords: meta, perf, Whiteboard: [perf-wanted])

User Story

Acceptance Criteria:
- no regressions
- app startup time should be less than 1000 ms
- app startup time is competitive to Android on same hardware

Reference:
- https://wiki.mozilla.org/FirefoxOS/Performance/Release_Acceptance#Criteria
This is a meta bug to keep bugs about application startup time improvement.
Depends on: 1102059
Summary: [meta] Improve application startup time on multicore devices → [meta] Investigate and improve application startup time on multicore devices
Depends on: 1102154
Depends on: 1110624
Depends on: 1110625
No longer depends on: 1074783, 1082262, 1082268, 1086963
feature-b2g: --- → 2.2?
User Story: (updated)
feature-b2g: 2.2? → 2.2+
No longer blocks: 1074783, 1082262, 1082268, 1086963
feature-b2g: 2.2+ → ---
User Story: (updated)
(We have a meta bug to remove all sync messaging happening during app startup, but I can't find it now.)
feature-b2g: --- → 2.2+
Depends on: 1112989
Depends on: 1087905
Depends on: 1096745
Depends on: 1089920
Please remove 2.2+, since this bug is not in the scope.

For 2.2, we commit only for concrete bugs that is blocking this bug.
Flags: needinfo?(bchien)
feature-b2g: 2.2+ → ---
tracking-b2g: --- → +
Flags: needinfo?(bchien)
Priority: -- → P1
Per discussion with Ravi and Ken.
User Story: (updated)
Assignee: nobody → bchien
User Story: (updated)
See Also: → 781613
See Also: → less-js-at-startup
Depends on: 1119692
Depends on: 1121310
Depends on: 1096782
Depends on: 1121897
Depends on: 1121905
User Story: (updated)
Depends on: 939695
Depends on: 1126119
Depends on: 1126681
No longer depends on: 939695
Blocks: 1127189
No longer blocks: 1127189
Depends on: 1127189
I've created an etherpad at https://etherpad.mozilla.org/FxOSQuadCoreOptimization for collecting ideas about quadcore optimization
No longer depends on: 1127189
No longer depends on: 1121905
Depends on: 1130993
At Gabrielle's suggestion, I tried turning on the notify_on_migrate feature with:

adb shell echo 1 > /dev/cpuctl/apps/cpu.notify_on_migrate

On my nexus5-l running master, this one change dropped Gallery app startup time from ~450ms to ~425ms (tested over 50 runs, so I think this is a real gain).

See bug 1081871 for more on notify_on_migrate. It is not enabled by default because it was causing stability issues on Flame, I think.
In the gallery bug 1086963, I've asked Tapas at CAF whether he knows of other techniques like setInteractive() from bug 890541 that might help with startup.
Depends on: 1129584
Depends on: 1132861
Depends on: 1133050
Depends on: 1132515
Depends on: 1137124
No longer depends on: 1094010
No longer depends on: 1137124
No longer depends on: 1130993
No longer depends on: 1121897
No longer depends on: 1119692
No longer depends on: 1126681
Depends on: 1140987
Depends on: 1128505
Still gaia-header takes time during app startup, here're the numbers from the profiles (Flame 319MB) at bug 1112131 comment 40 & 41:

+----------+--------+--------+
|          | v2.2   | master |
+----------+--------+--------+
| SMS      | ~130ms | ~155ms |
| Music    | ~210ms | ~170ms |
| Gallery  | ~260ms | ~205ms |
| Contacts | ~255ms | ~390ms |
+----------+--------+--------+
Depends on: 1143580
http://blog.chromium.org/2015/03/new-javascript-techniques-for-rapid.html

Wonder how do we process defer and async script, will take a look later.
(In reply to Ting-Yu Chou [:ting] from comment #8)
> http://blog.chromium.org/2015/03/new-javascript-techniques-for-rapid.html
> 
> Wonder how do we process defer and async script, will take a look later.

Defer script is compiled and executed on the main thread after downloaded, async script seems is compiled off main thread and executed on main thread.
Depends on: 1145498
(In reply to Ting-Yu Chou [:ting] from comment #9)
> (In reply to Ting-Yu Chou [:ting] from comment #8)
> > http://blog.chromium.org/2015/03/new-javascript-techniques-for-rapid.html
> > 
> > Wonder how do we process defer and async script, will take a look later.
> 
> Defer script is compiled and executed on the main thread after downloaded,
> async script seems is compiled off main thread and executed on main thread.

Quote Julien's bug 1093564 comment 1:

<quote>
  One idea: I think "async" scripts are now parsed in a separate thread; I don't think we use this at all in most apps because the LazyLoader we use set "async = false" to preserve script order.
</quote>

I have asked why defer scripts are not parsed off main thread in bug 906371.
Depends on: 1147048
I'll concentrate on Gecko as Gaia seems is going to have an architecture change in V3.
Depends on: 1150349
Alias: AppStartup
See Also: → 994296
Depends on: 1154987
Depends on: 1079585
Whiteboard: [perf-wanted]
Raptor now works with Nexus5, here're the numbers of visuallyLoaded I got from today's build with light reference workload:

Music    545.5ms
Contacts 448.450ms
Gallery  586.5ms
SMS      641.650ms

Command: RUNS=20 APP=... node tests/raptor/launch_test
Gecko: https://hg.mozilla.org/mozilla-central/rev/aad95360a002
Gaia: 5997b406e77ea726fbd9047057a1c3504f6cd6d4
The latest profile [1] from launching SMS with light reference workload:

  - Bug 1130993 still existed and takes >40ms
  - There's a 20ms incremental GC slice [119288, 119309] right before calling Webapps.launch(), I wonder should we prohibit GC in b2g process during this critical path

BTW, I noticed Raptor measures visuallyLoaded with the timestamp of mark appLaunch, which is before Homescreen calling app.launch(), not after sending touch event.
  
[1] http://people.mozilla.org/~bgirard/cleopatra/#report=9ca00bbd19a1585f5e3cbeb8a624da404ccbc6c4
    Gecko: https://hg.mozilla.org/mozilla-central/rev/1af1b4e1c35a
    Gaia: d22b4cd9d7a90fcd772bc9793fb0104eff019a41
No longer depends on: 1150349
Blocks: 1180695
Blocks: 1180696
No longer blocks: 1180695
Depends on: 1181019
Depends on: 1181021
Depends on: 1181023
Depends on: 1181017
No longer blocks: 1180696
Depends on: 1194121
Depends on: 1197063
Depends on: 1198185
See Also: → butter-delivery
Depends on: 1199539
This meta now grows to a giant, and actually not much about app startup improvement on more-core device, so filed bug 1199539 to keep them instead.

And here to keep bugs which can improve app startup no matter there're more cores or not.
No longer depends on: 1094011, 1154987, 1132861
Summary: [meta] Investigate and improve application startup time on multicore devices → [meta] Improve application startup performance
No longer blocks: B2G-Multicore
Depends on: less-js-at-startup
Depends on: 926452
Depends on: 1214516
Depends on: LowStorage
No longer depends on: LowStorage
tracking-b2g: + → ---
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.