Open Bug 979135 Opened 7 years ago Updated 7 years ago

Use custom layouts for toolbar

Categories

(Firefox for Android :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

People

(Reporter: wesj, Unassigned)

Details

Attachments

(1 file)

It might be nice to move to custom layout/measuring code for BrowserToolbar. RelativeLayouts aren't fast (and ours has one item with weight). Maybe we can do better?
Attached patch WIP PatchSplinter Review
This was a WIP I started here trying to get things to work on my phone (before I moved on to making it work on other phones/tablets). Using this I measured these methods taking around 2-20ms.

However, commenting these out and doing some timing in the normal methods (with calls to super.onMeasure()/etc) I didn't see a huge win. I saw a few 200ms calls, but most were very fast (2-20ms, maybe they're very smart about avoiding work if they can?)

Lucas, you have any idea if this is the right path here? Any advice?
Flags: needinfo?(lucasr.at.mozilla)
(In reply to Wesley Johnston (:wesj) from comment #1)
> Created attachment 8385114 [details] [diff] [review]
> WIP Patch
> 
> This was a WIP I started here trying to get things to work on my phone
> (before I moved on to making it work on other phones/tablets). Using this I
> measured these methods taking around 2-20ms.
> 
> However, commenting these out and doing some timing in the normal methods
> (with calls to super.onMeasure()/etc) I didn't see a huge win. I saw a few
> 200ms calls, but most were very fast (2-20ms, maybe they're very smart about
> avoiding work if they can?)
> 
> Lucas, you have any idea if this is the right path here? Any advice?

Yep, something along these lines. What I had in mind was to implement a measure/layout logic that is a lot more specific to our UI. So, BrowserToolbar would subclass ViewGroup (instead of RelativeLayout) and we'd optimize the measure/layout logic to our use case.

In any case, you're right: we'll have to benchmark the custom layout to evaluate whether it's worth the extra code. My guess is that custom layout implementations will give us bigger perf improvements on containers higher up in the hierarchy (especially if they involve multi-pass layout traversals).
Flags: needinfo?(lucasr.at.mozilla)
You need to log in before you can comment on or make changes to this bug.