Closed Bug 817070 Opened 12 years ago Closed 10 years ago

about:home gets laid out 8 times on fennec startup

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(fennec+)

RESOLVED INVALID
Tracking Status
fennec + ---

People

(Reporter: kats, Assigned: sriram)

References

Details

While investigating other issues, I stick a printout in Tabs.setThumbnailWidth, and on a normal startup on a Galaxy Nexus it got printed 48 times. Since there are 6 thumbnails on about:home, this means about:home is getting laid out 8 times, which seems a little excessive. I don't know why though - it might be justified, but there must be some optimizations we can do there.
(In reply to Kartikaya Gupta (:kats) from comment #0)
> While investigating other issues, I stick a printout in
> Tabs.setThumbnailWidth, and on a normal startup on a Galaxy Nexus it got
> printed 48 times. Since there are 6 thumbnails on about:home, this means
> about:home is getting laid out 8 times, which seems a little excessive. I
> don't know why though - it might be justified, but there must be some
> optimizations we can do there.

We add/show/hide many views in AboutHomeContent on startup which probably triggers successive relayouts on the view hierarchy. Maybe disabling certain sections of AboutHomeContent (tabs from last session, addons) to see if that makes any difference is a good way to start investigating this.
tracking-fennec: --- → ?
Blocks: 819468
Assignee: nobody → sriram
tracking-fennec: ? → +
Preliminary analysis:
About:Home is drawn several times because it's a ScrollView.

Here is how the startup sequence is like:
1. draw about:home
2. inflate() all sections.
3. load top sites.
4. draw about:home (to show top sites)
5. draw about:home (may be for the banner)
<--- load recommended addons from gecko -->
6. show addons section
7. draw about:home
8. and a bunch of (atleast 16) "draw about:home"

I tried using a LinearLayout instead of ScrollView. The number of about:home draw calls was just 4 (as it couldn't fit addons). And it definitely didn't have pt. 8 behavior (16 calls to about:home draw()).

When I tried scrolling just a bit (like 20-40 pixels), I got atleast 40 about:home draw() calls! This is scary. The main reason here is, Android isn't/couldn't cache the views to draw.

If it's just "isn't" caching: we could turn it on somehow.
If it's "couln't" cache: that may be due to use of our custom android views, which doesn't tell android if-and-how they can be cached.

Suggestions:
1. Chrome uses a tabbed behavior. That reduces the "scrolling" part.
2. Limit the about:home to be very simple. A long list inside ScrollView is a performance problem.
3. Reduce number of views in about:home. (as simple as it can be).

Animation note:
about:home is "not" redrawn while the "slide animation" happens. Not even a single time. So, we don't have to worry about about:home repainted on sliding down. (It's a translate animation and Android ( :cough: :cough: ) somehow does it properly.
This is a general investigation that doesn't necessarily apply to the new about:home implementation. This shouldn't block us (unless this is a massive performance issue in the code).
No longer blocks: new-about-home
A part of me feels like this is invalid now ... right?
Flags: needinfo?(lucasr.at.mozilla)
(In reply to Aaron Train [:aaronmt] from comment #4)
> A part of me feels like this is invalid now ... right?

The code has changed so much that I doesn't make sense to keep this bug around. We can file a new bug if we find similar issues in the new UI.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(lucasr.at.mozilla)
Resolution: --- → INVALID
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.