Slow loading of URLs or local pages (cold startup)

NEW
Unassigned

Status

()

Firefox for Android
General
6 years ago
a year ago

People

(Reporter: marco, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
If you open a URL or a local page with Firefox, it's extremely slow to load. This only happens with cold startups.
Can't we improve somehow this startup performance? I guess it's a common use case.
Loading URLs on a cold startup means Gecko needs to finish loading before we even start to load the URL. It can take Gecko 2-5 seconds to load, depending on the phone.

There is work being done to get gecko to start faster. Bug 777440 and bug 748488 will help. Let's try to morph this bug into something we can work on.
(Reporter)

Comment 2

6 years ago
I think the slowness I'm talking about isn't just related to Gecko loading. Gecko loading is obviously slower than hot startups, but looks like with cold startups we're doing more stuff before actually loading the page. Can't we delay something and give more priority to page loading?

(By cold startup I mean startup after you close the Firefox process, not after a reboot)
I've thought we were slow loading things like about:addons before, even if Gecko is running already. Is that the slowness we want to investigate here?
(Reporter)

Comment 4

6 years ago
(In reply to Wesley Johnston (:wesj) from comment #3)
> I've thought we were slow loading things like about:addons before, even if
> Gecko is running already. Is that the slowness we want to investigate here?

Not exactly :). But it's probably worth filing another bug for that, I'll file.
So, let me explain better.
If I open a local page (Firefox process closed), page loading is really slow (I guess Gecko loading is fast enough because the UI is drawn almost instantaneously, it's page loading that's slow).
If I open a local page with the Firefox process in execution, page loading is fast enough.
Ahh. Our UI doesn't depend on Gecko being loaded, just so that we can show it quickly! So the UI being up doesn't mean Gecko has loaded. To check that you an open the menu and watch for when the Settings menu item is enabled.
(Reporter)

Comment 6

6 years ago
(In reply to Wesley Johnston (:wesj) from comment #5)
> Ahh. Our UI doesn't depend on Gecko being loaded, just so that we can show
> it quickly! So the UI being up doesn't mean Gecko has loaded. To check that
> you an open the menu and watch for when the Settings menu item is enabled.

Ok, then it's definitely Gecko loading. If I open a local page, the Settings menu item is enabled just when the page is loaded.
Can we mitigate this somehow?
It's also weird from a UI point of view, because it looks like a page is being loaded while actually it's the application.

Maybe we can use a WebView to show the page and, when Gecko is ready, replace the contents with the page loaded by Gecko? It's just a crazy idea :)
I'm running the latest Beta version of Firefox on my LG Spectrum 2 and it takes around 130 seconds from the time I click a link in Gmail until it is completely loaded in the browser (spinner disappears, browser is responsive, etc).

Device specs:

OS: Android 4.1.2
Chipset: Qualcomm MSM8960 Snapdragon
CPU: Dual-core 1.5 GHz Krait
GPU: Adreno 225
Storage: 16 GB "disk", 1 GB RAM
720 x 1280 pixels, 4.7 inches (~312 ppi pixel density)

On my 2013 Nexus 7, it only takes about 40 seconds to load the same URL (Qualcomm Snapdragon™ S4 Pro, 1.5GHz, Adreno 320 GPU, 2GB RAM) and on my Kindle Fire HDX using Firefox 26.0.1, it takes 63 seconds to load the same URL (2.2ghz Snapdragon 800 Quad Core, Adreno 330 GPU, 2GB RAM).

This is over WiFi (24mbit/3mbit Uverse) and not 3G/4G.
(In reply to Brian Carpenter [:geeknik] from comment #7)
> I'm running the latest Beta version of Firefox on my LG Spectrum 2 and it
> takes around 130 seconds from the time I click a link in Gmail until it is
> completely loaded in the browser (spinner disappears, browser is responsive,
> etc).

All of the times you list are outrageously long. Some questions:
* Do you have any add-ons installed? If so, which ones?
* We need a sense of how long it's taking Gecko to load. You could try starting Firefox, opening the menu and watching for "Settings" to become enabled. We can look for other ways to do this too.
* How big is your profile? In the Android Settings > Apps, find Firefox Beta and look at the Storage | Data size.
* Does the link load faster if you just Refresh it inside Firefox? Or does it still take a long time?
* Does Nightly open the link from Gmail any faster?

Maybe we can make a data gathering add-on for you.

Thanks for any information you can give.
(In reply to Brian Carpenter [:geeknik] from comment #7)
> I'm running the latest Beta version of Firefox on my LG Spectrum 2 and it
> takes around 130 seconds from the time I click a link in Gmail until it is
> completely loaded in the browser (spinner disappears, browser is responsive,
> etc).

Also, to help create a baseline, can you give any timings using other browsers?
Add-ons: Adblock Plus, LastPass, URL Fixer
Profile Size: 110MB

It takes roughly 60 seconds on the LG Spectrum 2 for the Settings option in Firefox Beta to become touchable.

If I refresh the page after it is fully loaded, it only takes a few seconds to refresh the page. If I leave the browser open, click the home button to go back to my Android home screen and click the link in Gmail again, it continues taking 120+ seconds to load the page. 

The latest Chrome beta for Android loads the URL in 16 seconds from a cold start. The stock browser in Android 4.1.2 loads the URL in 9 seconds from a cold start.

The latest nightly for Android from http://nightly.mozilla.org loads this link in ~ 11 seconds. No extensions installed, sync not enabled, etc. I was not able to install Lastpass because it's not compatible, and I installed Adblock Plus, but I'm unable to setup a filter subscription because that part of the extension isn't catching touch events correctly.

The URL in question from my inbox: http://email.m1.instructables.com/c/Yz1jMHFmNiZkPTI4MTAmaT0yMDE0MDEyMjA1NDkyNi4xOTQ2MC40OTcwNCU0MG0xLmluc3RydWN0YWJsZXMuY29tJmg9Y2U4MzQzODk3MjQ4MDY3YTcyNDM5MGE2MmI4MGIyNzcmbT0xNW45Jmw9aHR0cCUzQSUyRiUyRnd3dy5pbnN0cnVjdGFibGVzLmNvbSUyRmNvbnRlc3QlMkZzbm93MjAxNCUyRiZyPWJyaWFuLmNhcnBlbnRlciU0MGdtYWlsLmNvbQ (http://www.instructables.com/contest/snow2014/).
(In reply to Brian Carpenter [:geeknik] from comment #10)
> Add-ons: Adblock Plus, LastPass, URL Fixer

> The latest nightly for Android from http://nightly.mozilla.org loads this
> link in ~ 11 seconds. No extensions installed, sync not enabled, etc. I was
> not able to install Lastpass because it's not compatible, and I installed
> Adblock Plus, but I'm unable to setup a filter subscription because that
> part of the extension isn't catching touch events correctly.

I believe this is caused by the add-ons. Which one, I don't know. We can install those into a local build and do some profiling to look for the cause. Thanks for the info.
Brian: can you capture an ADB log, starting just before you tap the link, and ending just after the page loads? It might contain a bunch of stuff that isn't sensitive but that you don't want public, so feel free to sanitize it or just send it directly to me.

Thanks!
Depends on: 959776
Flags: needinfo?(brian.carpenter)
AdBlock Pro in-conjunction with Gecko slowness has been reported for over a year now but has not really been investigated

See bug 834548 and bug 947162.
Here is a Gecko profile of startup on a Galaxy Nexus with AdblockPlus installed:
http://people.mozilla.org/~bgirard/cleopatra/#report=c6f4e2b4d305f6c884c25fbb18111be00abc6caf

Some big hits:

7186ms
Startup::XRE_Main
  Input::nsInputStreamPump::OnInputStreamReady
    Input::nsInputStreamPump::OnStateTransfer
      content::nsXMLHttpRequest::OnStopRequest
        nsEventDispatcher::Dispatch
          js::RunScript
            exports.IO.readFromFile/<() @ io.js:110

843ms
Startup::XRE_Main
  js::RunScript
    exports.IO.writeToFile/writeNextChunk/<.onOutputStreamReady() @ io.js:222

800ms
Startup::XRE_Main
  js::RunScript
    exports.IO.writeToFile/<.onStopRequest() @ io.js:173

121ms
Startup::XRE_Main
  Input::nsInputStreamPump::OnInputStreamReady
    Input::nsInputStreamPump::OnStateTransfer
      content::nsXMLHttpRequest::OnStopRequest
        nsEventDispatcher::Dispatch
          js::RunScript
            exports.UI.init/<() @ ui.js:288
(In reply to Mark Finkle (:mfinkle) from comment #15)
> Here is a Gecko profile of startup on a Galaxy Nexus with AdblockPlus
> installed:

Can we sum that up as "fetching a network file and flushing it to disk in the hot path of startup"?
(In reply to Richard Newman [:rnewman] from comment #16)
> (In reply to Mark Finkle (:mfinkle) from comment #15)
> > Here is a Gecko profile of startup on a Galaxy Nexus with AdblockPlus
> > installed:
> 
> Can we sum that up as "fetching a network file and flushing it to disk in
> the hot path of startup"?

Not necessarily. The IO is async, but there are lots of RegEx happening. Lots of objects being created and GC'd too.
Blocks: 959776
No longer depends on: 959776
Depends on: 834548

Comment 18

4 years ago
I have the same problem on my Nexus 4 with Android 4.4.2 .
When i need to search something fast i have to use other browsers because loading the fisrt page on Firefox is extremely slow. 

Example: search "ciao" on google, dolphin finds the results in 2sec and firefox in 21sec, both cold startup.

Comment 19

4 years ago
Without adblock plus everything is fast! O.o
Enrico, thanks for letting us know. This is a known issue with AdBlock Plus and Firefox. We're trying to resolve the performance problem hopefully sometime very soon.
My apologies, but I no longer have the LG device.
Could someone clear the needinfo request for me? I've tried and it is still nagging me.
Flags: needinfo?(brian.carpenter)

Updated

4 years ago
Duplicate of this bug: 962702
You need to log in before you can comment on or make changes to this bug.