Creating or switching to a new tab feels slow

Bug #1585285 reported by Michal Predotka
44
This bug affects 17 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Unassigned
qtbase-opensource-src (Ubuntu)
New
Undecided
Unassigned
webbrowser-app (Ubuntu)
Fix Released
High
Olivier Tilloy

Bug Description

bq M10 rc-proposed r112

Steps to reproduce:
1. Open few tabs with websites
2. Click 'New tab' button

Expected result:
Browser creates new tab and switches to it immediately.

What happens instead:
New tab is created and browser switches to it after about 2-3 seconds. Long enough to makes me worried if everything is fine with it.

Similar situation is when I have a 'new tab' already opened as a background tab. When I switch to it from a tab with a webpage, the action is taking too long.

Related branches

summary: - Creating or swinging to a new tab feels slow
+ Creating or switching to a new tab feels slow
Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

Confirmed on latest rc-proposed today on M10.

Changed in webbrowser-app (Ubuntu):
status: New → Confirmed
Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

Here's a video showing it.

https://youtu.be/FcarlJiZtNg

Revision history for this message
Olivier Tilloy (osomon) wrote :

On my beefy laptop, when opening a new tab, the UrlGridView for the list of top sites in the new tab view takes ~250ms to instantiate, of which almost half the time (115ms) is for instantiating the Loader that contains one Favicon.

After moving away the favicons cache folder, instantiating the favicons is almost instantaneous (they are being re-downloaded on a different thread), and instantiating the UrlGridView is down to 170ms, which is still expensive, but better.

I instrumented the favicon fetcher code, and the culprit seems to be the first icon being downloaded (usually because the favicon doesn’t actually exist, but we’re not tracking that, so we try to download it anyway because it hasn’t been cached on disk). Specifically, on my laptop instantiating the first QNetworkAccessManager takes ~100ms. One QNAM is being instantiated for each favicon that we fetch from the network, but the subsequent instantiations are free, only the first one is expensive. This would need some further investigation in Qt itself.

One optimization we could try to apply is to cache an empty file on disk for non-existent favicons, in order to avoid trying to re-download them over and over again.

Changed in webbrowser-app (Ubuntu):
importance: Undecided → High
assignee: nobody → Olivier Tilloy (osomon)
Revision history for this message
Olivier Tilloy (osomon) wrote :

I experimented with a very simple test application to measure how expensive it is to create instances of QNetworkAccessManager, and the results are consistent (and surprisingly similar on my beefy laptop and on an MX4):

int main(int argc, char** argv) {
  QCoreApplication app(argc, argv);
  for (int i = 0; i < 10; ++i) {
    QElapsedTimer timer;
    timer.start();
    QNetworkAccessManager nam;
    qDebug() << i << "elapsed:" << timer.elapsed();
  }
  return 0;
}

The first instance takes anywhere between 75 and 125ms to create, subsequent instances are free.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I finally got around to doing some profiling on actual touch devices, and the expensive operation was instantiating images synchronously for grid delegates. Doing it asynchronously speeds up the grid view creation significantly.

Changed in webbrowser-app (Ubuntu):
status: Confirmed → In Progress
Changed in canonical-devices-system-image:
status: New → Fix Committed
importance: Undecided → High
milestone: none → 12
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package webbrowser-app - 0.23+16.10.20160615-0ubuntu1

---------------
webbrowser-app (0.23+16.10.20160615-0ubuntu1) yakkety; urgency=medium

  * Fix the anchoring of the contents in the bookmarks views. (LP:
    #1584385)
  * Various favicon optimizations. (LP: #1585285)
  * Load top site previews asynchronously to speed up the instantiation
    of the grid view. (LP: #1585285)
  * Fix cross-compilation for armhf on a x86* host. (LP: #1588788)
  * Update UA overrides (mobile) for youtube and gmail.

 -- Olivier Tilloy <email address hidden> Wed, 15 Jun 2016 09:35:09 +0000

Changed in webbrowser-app (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in qtbase-opensource-src (Ubuntu):
status: New → Confirmed
Olivier Tilloy (osomon)
Changed in qtbase-opensource-src (Ubuntu):
status: Confirmed → New
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.