Closed Bug 959944 Opened 6 years ago Closed 4 years ago

GeckoApp.restoreSessionTabs can be expensive and is on main thread

Categories

(Firefox for Android :: General, defect)

ARM
Android
defect
Not set

Tracking

()

RESOLVED DUPLICATE of bug 905223

People

(Reporter: mfinkle, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

I have a Nexus S startup profile where we restore cnn.com from session. As expected GeckoApp.restoreSessionTabs is called, but it is on the main thread and accounts for 6.6% (~350ms) of startup time.

Most of the time is JSONObject.toString (~218ms) but SessionParser.parse is #2 (~96ms) and GeckoProfile.readSessionFile is #3 (~35ms).

Since this is all on the main thread it blocks the "next" bit of work, which appears to be starting to load the Gecko libraries.

profile: http://people.mozilla.org/~mfinkle/fennec/profiles/nexuss-cnn-startup.trace
Keywords: perf
One thing I saw when looking at the code. If we are not restoring, we seem to:
1. Read the sessionString
2. Convert the string to a JSON object
3. Convert the JSON to a string
4. Return the string

We could probably improve that.

http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/GeckoApp.java#1659
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/GeckoApp.java#1704
We seem to only be calling restoreSessionTabs if we know we need to restore. So comment 1 might be moot.

http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/GeckoApp.java#1471

I think we should either fix the issue in comment 1 or remove the mShouldRestore check in restoreSessionTabs.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 905223
You need to log in before you can comment on or make changes to this bug.