[Page Thumbnails] Large jank soon after switching tabs

NEW
Unassigned

Status

()

7 years ago
6 years ago

People

(Reporter: taras.mozilla, Unassigned)

Tracking

(Depends on: 1 bug, Blocks: 1 bug, {perf})

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [Snappy:P1])

(Reporter)

Description

7 years ago
We must be running some setTimeout()ed js after switching tabs, because I experience a 200-400ms pause a few hundred milliseconds after switching to a tab. This correlates with session-store + tab screenshoting(correlation does not equal blame)

340 ({FX_SESSION_RESTORE_COLLECT_DATA_MS:[[5, 1]], FX_SESSION_RESTORE_SERIALIZE_DATA_MS:[[3, 1]], GC_INCREMENTAL_DISABLED:[[0, 1]], GC_IS_COMPARTMENTAL:[[1, 1]], GC_MARK_MS:[[12, 1]], GC_MMU_50:[[4, 1]], GC_MS:[[17, 1]], GC_NON_INCREMENTAL:[[1, 1]], GC_REASON:[[5, 1]], GC_RESET:[[0, 1]], GC_SLICE_MS:[[17, 1]], GC_SWEEP_MS:[[12, 1]]})

Above shows a 300+ms jank, where session store took <10ms, GC took <40ms. There is a 100% correlation between this jank and above session-store telemetry activity, so I'm guessing the jank is trigger by some related javascript.

I can reproduce this on multiple windows machines, but not on Mac.
If it's tab that's already been loaded, then Session restore only does the following on TabSelect:
1. update an index
2. tell crash reporter to update it's current URL (possible that's doing something janky)

I don't think there are any setTimeouts in that path in sessionstore.

If the tab hasn't been restored then we do that, which does have some expected overhead associated with it.

Can you be more specific about which case it is?

https://mxr.mozilla.org/mozilla-central/source/browser/components/sessionstore/src/nsSessionStore.js#1201
We're taking screenshots of tabs ~2 secs after they've been selected. So that really might be the culprit. Does the jank still occur when commenting out the following line?

http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-thumbnails.js#57

Updated

7 years ago
Keywords: perf
(Reporter)

Comment 3

7 years ago
(In reply to Paul O'Shannessy [:zpao] from comment #1)
> If it's tab that's already been loaded, then Session restore only does the
> following on TabSelect:
> 1. update an index
> 2. tell crash reporter to update it's current URL (possible that's doing
> something janky)
> 
> I don't think there are any setTimeouts in that path in sessionstore.
> 
> If the tab hasn't been restored then we do that, which does have some
> expected overhead associated with it.
> 
> Can you be more specific about which case it is?

This after the session has been restored. Tim's suggestion sounds plausible. It could be a combination of network cache locking and screenshoting. I'll try commenting out that line.
(Reporter)

Comment 4

7 years ago
So I was going to try this, but there is no point. My i7 macbook air is probably triggering cache locking issues seen in http://dl.dropbox.com/u/5961467/moz/FX_THUMBNAILS_STORE_TIME_MS.png. Checkout my local histograms: http://dl.dropbox.com/u/5961467/moz/fx_thumbnails_local.png. Both capture time and storing time is terrible.
(Reporter)

Comment 5

7 years ago
I suspect a couple of things are inplay here
a) slow capture time
b) cache locking negating your async efforts while cache entry is written
c) doing capture AND write during the same setTimeout

Given how expensive drawWindow is, can we do some sort of exponential backoff for users who have slow machines(or don't ever click on thumbnails?)
(Reporter)

Updated

7 years ago
Whiteboard: [Snappy] → [Snappy:P2]
(Reporter)

Comment 6

7 years ago
(In reply to Taras Glek (:taras) from comment #5)
> I suspect a couple of things are inplay here
> a) slow capture time
> b) cache locking negating your async efforts while cache entry is written
> c) doing capture AND write during the same setTimeout
> 

Looks c) is not a problem.
(Reporter)

Updated

7 years ago
Blocks: 743069
(Reporter)

Comment 7

7 years ago
P1 as this manifests rather nastily when switching tabs
Whiteboard: [Snappy:P2] → [Snappy:P1]
Depends on: 744152
Depends on: 744388
tracking-firefox14: --- → ?
Whoops, sorry, wrong bug.
tracking-firefox14: ? → ---
Depends on: 752918
Blocks: 789573

Updated

6 years ago
Component: Session Restore → General

Updated

6 years ago
No longer blocks: 743069

Updated

6 years ago
No longer depends on: 743877

Updated

6 years ago
No longer depends on: 752918

Updated

6 years ago
Summary: Large jank soon after switching tabs → [Page Thumbnails] Large jank soon after switching tabs

Updated

6 years ago
Depends on: 720575
You need to log in before you can comment on or make changes to this bug.