Closed Bug 1013155 Opened 10 years ago Closed 10 years ago

[Keyboard] Don't wait for IMEngine for showing the keyboard

Categories

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

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED
1.4 S6 (25apr)

People

(Reporter: timdream, Assigned: timdream)

References

Details

(Keywords: perf, Whiteboard: [c=progress p= s=2014.07.18.t u=] [p=5][save=~120ms])

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #970188 +++

I have patch ready.
Whiteboard: [p=3][save=~100ms]
[kbdmgr] 1400574036224
[kbdTime] keyboard.js, 0, 242, 1400574036708
[kbdTime] initKeyboard, 3, 245, 1400574036710
[kbdTime] initKeyboard->setKeyboardName->showKeyboard, 82, 324, 1400574036789, 79
[kbdTime] setKeyboardName, 86, 328, 1400574036793
[kbdTime] setLayout, 198, 440, 1400574036905
[kbdTime] showKeyboard, 207, 449, 1400574036914
[kbdTime] renderKeyboard, 208, 450, 1400574036915
[kbdTime] BLOCKING renderKeyboard, 305, 547, 1400574037012, 96
[kbdTime] switchIMEngine, 319, 561, 1400574037026
[kbdTime] dimensionsObserver:callback, 321, 563, 1400574037028
[kbdTime] updateTargetWindowHeight, 324, 566, 1400574037031
[kbdTime] IMERender.draw:callback, 1242, 1484, 1400574037949
[kbdTime] BLOCKING IMERender.draw:callback, 1254, 1496, 1400574037961, 2
[kbdTime] attachResizeListener, 2160, 2402, 1400574038867
[kbdTime] switchIMEngine:dataPromise resolved, 2308, 2550, 1400574039015
[kbdTime] glue.sendCandidates, 2329, 2571, 1400574039036
[kbdTime] switchIMEngine:promise resolved, 2336, 2578, 1400574039044
[kbdTime] renderKeyboard, 2345, 2587, 1400574039052
[kbdTime] BLOCKING renderKeyboard, 2429, 2671, 1400574039136, 84
[kbdTime] dimensionsObserver:callback, 2430, 2672, 1400574039137
[kbdTime] updateTargetWindowHeight, 2430, 2672, 1400574039138
[kbdTime] IMERender.draw:callback, 2801, 3043, 1400574039508
[kbdTime] glue.sendCandidates, 2869, 3111, 1400574039576
[kbdTime] BLOCKING IMERender.draw:callback, 2890, 3132, 1400574039598, 88

1400574037031- 1400574036224

With this patch, it only takes 807ms to go from contextchange to updateTargetWindowHeight().
Comment on attachment 8425321 [details] [review]
mozilla-b2g:master PR#19421

There are some integration test breakage but I think we should start the review process now.
Attachment #8425321 - Flags: review?(rlu)
This bug takes longer to fix since both JS and Python int tests are failing.
Whiteboard: [p=3][save=~100ms] → [p=5][save=~100ms]
Patch now updated with Part VI - Part VIII. It turned out I am only measuring the time JavaScript returns, not the time it takes to run the layout. Patch VII now add a trick to solve that. It also get rid of the flashing of background when keyboard launches.

Below is the measurement with only Patch VI and VII (measured against "Add contact" dialog):
1400666972828 - 1400666971607 = 1221ms

I/GeckoDump(  108): [kbdmgr] 1400666971607
I/GeckoDump( 1004): [kbdTime] keyboard.js, 0, 284, 1400666972124
I/GeckoDump( 1004): [kbdTime] initKeyboard, 8, 292, 1400666972131
I/GeckoDump( 1004): [kbdTime] initKeyboard->setKeyboardName->showKeyboard, 87, 371, 1400666972210, 79
I/GeckoDump( 1004): [kbdTime] setKeyboardName, 88, 372, 1400666972211
I/GeckoDump( 1004): [kbdTime] loadLayout, 88, 372, 1400666972211
I/GeckoDump( 1004): [kbdTime] setLayout, 216, 500, 1400666972339
I/GeckoDump( 1004): [kbdTime] loadIMEngine, 216, 500, 1400666972339
I/GeckoDump( 1004): [kbdTime] setInputMethod, 258, 542, 1400666972381
I/GeckoDump( 1004): [kbdTime] showKeyboard, 259, 543, 1400666972382
I/GeckoDump( 1004): [kbdTime] doShowKeyboard, 331, 615, 1400666972454
I/GeckoDump( 1004): [kbdTime] glue.sendCandidates, 339, 623, 1400666972462
I/GeckoDump( 1004): [kbdTime] renderKeyboard, 346, 630, 1400666972469
I/GeckoDump( 1004): [kbdTime] IMERender.draw, 358, 642, 1400666972482
I/GeckoDump( 1004): [kbdTime] IMERender.resizeUI, 439, 723, 1400666972562
I/GeckoDump( 1004): [kbdTime] IMERender.resizeUI:setKeyWidth, 441, 725, 1400666972564
I/GeckoDump( 1004): [kbdTime] BLOCKING IMERender.resizeUI:setKeyWidth, 451, 735, 1400666972574, 10
I/GeckoDump( 1004): [kbdTime] BLOCKING IMERender.resizeUI, 701, 985, 1400666972824, 262
I/GeckoDump( 1004): [kbdTime] BLOCKING IMERender.draw, 701, 985, 1400666972824, 342
I/GeckoDump( 1004): [kbdTime] BLOCKING renderKeyboard, 703, 987, 1400666972826, 357
I/GeckoDump( 1004): [kbdTime] dimensionsObserver:callback, 704, 988, 1400666972827
I/GeckoDump( 1004): [kbdTime] updateTargetWindowHeight, 705, 989, 1400666972828
I/GeckoDump( 1004): [kbdTime] IMERender.resizeUI:getVisualData, 1057, 1341, 1400666973180
I/GeckoDump( 1004): [kbdTime] IMERender.draw:callback, 1088, 1372, 1400666973211
I/GeckoDump( 1004): [kbdTime] glue.sendCandidates, 1148, 1432, 1400666973271
I/GeckoDump( 1004): [kbdTime] BLOCKING IMERender.draw:callback, 1162, 1446, 1400666973285, 73
I/GeckoDump( 1004): [kbdTime] BLOCKING IMERender.resizeUI:getVisualData, 1165, 1449, 1400666973288, 107
I/GeckoDump( 1004): [kbdTime] attachResizeListener, 1166, 1450, 1400666973289

This is the measurement of the whole patch:
1400667188373 - 1400667187274 = 1099ms

I/GeckoDump(  108): [kbdmgr] 1400667187274
I/GeckoDump( 1043): [kbdTime] keyboard.js, 0, 284, 1400667187779
I/GeckoDump( 1043): [kbdTime] initKeyboard, 4, 288, 1400667187782
I/GeckoDump( 1043): [kbdTime] initKeyboard->setKeyboardName->showKeyboard, 92, 376, 1400667187870, 88
I/GeckoDump( 1043): [kbdTime] setKeyboardName, 93, 377, 1400667187871
I/GeckoDump( 1043): [kbdTime] setLayout, 204, 488, 1400667187982
I/GeckoDump( 1043): [kbdTime] showKeyboard, 214, 498, 1400667187992
I/GeckoDump( 1043): [kbdTime] renderKeyboard, 215, 499, 1400667187993
I/GeckoDump( 1043): [kbdTime] IMERender.draw, 228, 512, 1400667188006
I/GeckoDump( 1043): [kbdTime] IMERender.resizeUI, 308, 592, 1400667188086
I/GeckoDump( 1043): [kbdTime] IMERender.resizeUI:setKeyWidth, 309, 593, 1400667188088
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.resizeUI:setKeyWidth, 321, 605, 1400667188099, 11
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.resizeUI, 574, 858, 1400667188352, 266
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.draw, 575, 859, 1400667188353, 347
I/GeckoDump( 1043): [kbdTime] BLOCKING renderKeyboard, 576, 860, 1400667188354, 361
I/GeckoDump( 1043): [kbdTime] switchIMEngine, 592, 876, 1400667188370
I/GeckoDump( 1043): [kbdTime] dimensionsObserver:callback, 594, 878, 1400667188372
I/GeckoDump( 1043): [kbdTime] updateTargetWindowHeight, 595, 879, 1400667188373
I/GeckoDump( 1043): [kbdTime] IMERender.resizeUI:getVisualData, 659, 943, 1400667188437
I/GeckoDump( 1043): [kbdTime] IMERender.draw:callback, 686, 970, 1400667188464
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.draw:callback, 689, 973, 1400667188467, 2
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.resizeUI:getVisualData, 691, 975, 1400667188469, 29
I/GeckoDump( 1043): [kbdTime] switchIMEngine:dataPromise resolved, 1539, 1823, 1400667189318
I/GeckoDump( 1043): [kbdTime] glue.sendCandidates, 1569, 1853, 1400667189347
I/GeckoDump( 1043): [kbdTime] BLOCKING setUpperCase:requestAnimationFrame:callback, 1571, 1855, 1400667189349, 1
I/GeckoDump( 1043): [kbdTime] switchIMEngine:promise resolved, 1581, 1865, 1400667189359
I/GeckoDump( 1043): [kbdTime] renderKeyboard, 1603, 1887, 1400667189381
I/GeckoDump( 1043): [kbdTime] IMERender.draw, 1611, 1895, 1400667189389
I/GeckoDump( 1043): [kbdTime] IMERender.resizeUI, 1982, 2266, 1400667189760
I/GeckoDump( 1043): [kbdTime] IMERender.resizeUI:setKeyWidth, 2001, 2285, 1400667189779
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.resizeUI:setKeyWidth, 2043, 2327, 1400667189821, 40
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.resizeUI, 2398, 2682, 1400667190176, 407
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.draw, 2413, 2697, 1400667190191, 795
I/GeckoDump( 1043): [kbdTime] BLOCKING renderKeyboard, 2414, 2698, 1400667190192, 810
I/GeckoDump( 1043): [kbdTime] dimensionsObserver:callback, 2416, 2700, 1400667190194
I/GeckoDump( 1043): [kbdTime] updateTargetWindowHeight, 2419, 2703, 1400667190198
I/GeckoDump( 1043): [kbdTime] IMERender.resizeUI:getVisualData, 2583, 2867, 1400667190361
I/GeckoDump( 1043): [kbdTime] IMERender.draw:callback, 2587, 2871, 1400667190365
I/GeckoDump( 1043): [kbdTime] glue.sendCandidates, 2659, 2943, 1400667190437
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.draw:callback, 2668, 2952, 1400667190446, 69
I/GeckoDump( 1043): [kbdTime] BLOCKING IMERender.resizeUI:getVisualData, 2669, 2953, 1400667190447, 85
I/GeckoDump( 1043): [kbdTime] attachResizeListener, 2673, 2957, 1400667190451
Whiteboard: [p=5][save=~100ms] → [p=5][save=~120ms]
I've not looked into the code in detail, but I noticed 2 issues,
 1. When you switch between the keyboard layouts by pressing the globe key, you would see the suggestion candidate panel hides and then shows.

 2. Another similar issue is if you switch the focus between different input fields, like in contacts app, switch between "name" and "last name" field.
    Or in Message app > new message, click the gray area between "To" and "Message field", you would see candidate panel flickering.
(In reply to Rudy Lu [:rudyl] from comment #6)
> I've not looked into the code in detail, but I noticed 2 issues,
>  1. When you switch between the keyboard layouts by pressing the globe key,
> you would see the suggestion candidate panel hides and then shows.
> 
>  2. Another similar issue is if you switch the focus between different input
> fields, like in contacts app, switch between "name" and "last name" field.
>     Or in Message app > new message, click the gray area between "To" and
> "Message field", you would see candidate panel flickering.

I've noticed that to and this has been addressed in Patch IX of the pull request.

Also, tests have now fixed locally. Waiting for Travis-CI to run.
Comment on attachment 8425321 [details] [review]
mozilla-b2g:master PR#19421

r=me, please help address some nits/typos commented on the pull request.
Thank you.
Attachment #8425321 - Flags: review?(rlu) → review+
It's almost off-work hour in Taipei. I don't plan to deal with possible test breakage on weekend, so I will land this only until late Sunday night Taipei time.
Target Milestone: --- → 1.4 S6 (25apr)
master: https://github.com/mozilla-b2g/gaia/commit/56d404d7e202f6ba2f256d87eedec136cb9de694
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Depends on: 1017327
Keywords: perf
Whiteboard: [p=5][save=~120ms] → [c=progress p= s=2014.07.18.t u=] [p=5][save=~120ms]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: