Closed Bug 927324 Opened 11 years ago Closed 10 years ago

Showing the keyboard has a lot of expensive reflows in it

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: vingtetun, Unassigned)

References

Details

(Keywords: perf, Whiteboard: [c=effect p= s= u=])

Attachments

(1 file)

Attached patch View keyboard app reflows (deleted) — Splinter Review
When the keyboard is triggered to be shown there is a lot of expensive reflows in it that makes it slower to load. The time in parenthesis are in ms.

I/GeckoDump( 2576):   interruptible Reflow (16.784668000182137) 
I/GeckoDump( 2576): Stack: updateTargetWindowHeight@app://keyboard.gaiamobile.org/gaia_build_index.js:105|initKeyboard/dimensionsObserver<@app://keyboard.gaiamobile.org/gaia_build_index.js:62|
I/GeckoDump( 2576):   interruptible Reflow (18.2800289997831) 
I/GeckoDump( 2576): Stack: updateTargetWindowHeight@app://keyboard.gaiamobile.org/gaia_build_index.js:105|initKeyboard/dimensionsObserver<@app://keyboard.gaiamobile.org/gaia_build_index.js:62|
I/GeckoDump( 2576): uninterruptible Reflow (32.56225600000471) 
I/GeckoDump( 2576): Stack: candidatePanelToggleButtonCode@app://keyboard.gaiamobile.org/gaia_build_index.js:51|kr_draw@app://keyboard.gaiamobile.org/gaia_build_index.js:13|drawKeyboard@app://keyboard.gaiamobile.org/gaia_build_index.js:95|renderKeyboard@app://keyboard.gaiamobile.org/gaia_build_index.js:97|doShowKeyboard@app://keyboard.gaiamobile.org/gaia_build_index.js:193|gotText@app://keyboard.gaiamobile.org/gaia_build_index.js:195|
I/GeckoDump( 2576): uninterruptible Reflow (1.7089840001426637) 
I/GeckoDump( 2576): Stack: showCandidates@app://keyboard.gaiamobile.org/gaia_build_index.js:15|kr_draw@app://keyboard.gaiamobile.org/gaia_build_index.js:13|drawKeyboard@app://keyboard.gaiamobile.org/gaia_build_index.js:95|renderKeyboard@app://keyboard.gaiamobile.org/gaia_build_index.js:97|doShowKeyboard@app://keyboard.gaiamobile.org/gaia_build_index.js:193|gotText@app://keyboard.gaiamobile.org/gaia_build_index.js:195|

Making those reflows lighter will make it display faster.

Attached is the script I'm using to see those reflows. It will moves into a devtool at some point (bug 926371) but it is already good to start using it without waiting.

Tim, do you have some resources to work on it?
Flags: needinfo?(timdream)
I have done quite some stuff about keyboard rendering (also trying to minimize the reflows) in bug 875963 (which is pending review).
Whiteboard: [c= p= s= u=]
I would redirect ni? to djf as he intend to take over keyboard UI from v1.3.
Flags: needinfo?(timdream) → needinfo?(dflanagan)
Here's some more information I have from filing my dupe:

STR:
1) Profile with |./profile.sh start -p b2g|
2) Toggle the keyboard on the Homescreen using 'I'm thinking of...' input box
3) Capture profile using |./profile.sh capture| and open file at http://people.mozilla.org/~bgirard/cleopatra/

This will give you a profile like this:
http://people.mozilla.org/~bgirard/cleopatra/#report=9a1c537eb937bdd2132a91c760e4979864d66ae6&search=resizeUI

I'm not an export here but a first looks:
The script interleaves severals call to window.innerWidth/innerHeight/clientWidth/offsetWidth with DOM modificatins. This means that we have to force several sync reflows to answer these queries. Ideally we need to avoid all queries that require a sync reflow.
While trying to repro this, I noticed that the stacks for each reflow are gone, so they must be getting triggered by native code (or the interface has changed, which wouldn't make sense since it's spec'd).

I now count: 5 reflows on initial keyboard showing, 4 reflows on every showing after that. I can really only justify 2 in either case. The 2 should be caused by: a. drawing the keyboard, and b. resizing the frame that is being hidden by the keyboard.

I think BenWa's guess is reasonable, especially based on the stacks of the first two reflows that vingtetun posted. I'm going to poke at that.
Please note that the render code has changed around a bit in bug 875963, where we also tried to reduce reflows.
This is going completely crazy with APZ on again. Fine without it.
Priority: -- → P3
Whiteboard: [c= p= s= u=] → [c=effect p= s= u=]
(In reply to Jan Jongboom [:janjongboom] (Telenor) from comment #7)
> This is going completely crazy with APZ on again. Fine without it.

Should be consider this as fixed now? Anything need to be worked on specifically?
Flags: needinfo?(21)
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) (please ni?) from comment #8)
> (In reply to Jan Jongboom [:janjongboom] (Telenor) from comment #7)
> > This is going completely crazy with APZ on again. Fine without it.
> 
> Should be consider this as fixed now? Anything need to be worked on
> specifically?

This can probably be closed. Fwiw I expect bug 970093 to improve a lot the situation here.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Bulk edit to clear old and out of date needinfo requests that I never responded to. I'm assuming that these are no longer relevant. If you are still waiting for an answer from me, please set needinfo? again.
Flags: needinfo?(dflanagan)
Flags: needinfo?(21)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: