RESOLVED FIXED Bug 194003
Responsiveness timers are too expensive for frequent events
https://bugs.webkit.org/show_bug.cgi?id=194003
Summary Responsiveness timers are too expensive for frequent events
Benjamin Poulain
Reported 2019-01-29 20:45:17 PST
<rdar://problem/47570443> Responsiveness timers are too expensive for frequent events
Attachments
Patch (8.25 KB, patch)
2019-01-29 21:13 PST, Benjamin Poulain
no flags
Patch (8.44 KB, patch)
2019-01-30 19:28 PST, Benjamin Poulain
no flags
Patch (19.35 KB, patch)
2019-02-06 18:00 PST, Benjamin Poulain
no flags
Patch (12.44 KB, patch)
2019-02-11 21:38 PST, Benjamin Poulain
ews-watchlist: commit-queue-
Archive of layout-test-results from ews115 for mac-highsierra (2.08 MB, application/zip)
2019-02-11 23:27 PST, EWS Watchlist
no flags
Patch (12.44 KB, patch)
2019-02-12 00:26 PST, Benjamin Poulain
no flags
Benjamin Poulain
Comment 1 2019-01-29 21:13:35 PST
Geoffrey Garen
Comment 2 2019-01-30 14:27:47 PST
Comment on attachment 360549 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360549&action=review r=me > Source/WebKit/ChangeLog:22 > + The second improvement of the patch is to avoid that by not killing the timer > + when we hear back from the WebProcess. I wonder if we should just make this the default behavior of WebCore::Timer or ResponsivenessTimer. > Source/WebKit/ChangeLog:30 > + In the case of wheel events, this is find since we saved a bunch of CPU already. fine
Geoffrey Garen
Comment 3 2019-01-30 14:28:30 PST
Please make sure to verify manually that you still see the SPOD cursor in response to clicks and wheel events and typing if the web process is hung.
Benjamin Poulain
Comment 4 2019-01-30 16:44:16 PST
Thanks for the review. (In reply to Geoffrey Garen from comment #2) > > Source/WebKit/ChangeLog:22 > > + The second improvement of the patch is to avoid that by not killing the timer > > + when we hear back from the WebProcess. > > I wonder if we should just make this the default behavior of WebCore::Timer > or ResponsivenessTimer. That was my original idea. The problem is every timer except fo wheel event was causing an idle wake. Idle wake can really ruin your day (e.g. rdar://problem/46298048). (In reply to Geoffrey Garen from comment #3) > Please make sure to verify manually that you still see the SPOD cursor in > response to clicks and wheel events and typing if the web process is hung. Will do.
Benjamin Poulain
Comment 5 2019-01-30 19:28:00 PST
Benjamin Poulain
Comment 6 2019-01-30 19:37:37 PST
Tested by: -Disable "platformIsBeingDebugged" -Use lldb to stop the WebProcess -Click on the page. -Type in a text field -Scroll with wheel events
WebKit Commit Bot
Comment 7 2019-01-30 20:53:41 PST
Comment on attachment 360676 [details] Patch Clearing flags on attachment: 360676 Committed r240759: <https://trac.webkit.org/changeset/240759>
WebKit Commit Bot
Comment 8 2019-01-30 20:53:42 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2019-01-30 20:54:34 PST
Simon Fraser (smfr)
Comment 10 2019-01-30 22:01:49 PST
Comment on attachment 360676 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360676&action=review > Source/WebKit/ChangeLog:26 > + Using WebCore::Timer saves some instructions but we were still hitting > + the kernel at 120hz to set up then kill each timer. > + The second improvement of the patch is to avoid that by not killing the timer > + when we hear back from the WebProcess. > + > + Instead of killing the timer, we let it run and ignore the result. > + When the next event comes, we reschedule the existing timer. > + This brings down the timers to 60Hz, the same rate as the events. Could this have used DeferrableOneShotTimer?
Benjamin Poulain
Comment 11 2019-01-30 23:13:17 PST
(In reply to Simon Fraser (smfr) from comment #10) > Comment on attachment 360676 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=360676&action=review > > > Source/WebKit/ChangeLog:26 > > + Using WebCore::Timer saves some instructions but we were still hitting > > + the kernel at 120hz to set up then kill each timer. > > + The second improvement of the patch is to avoid that by not killing the timer > > + when we hear back from the WebProcess. > > + > > + Instead of killing the timer, we let it run and ignore the result. > > + When the next event comes, we reschedule the existing timer. > > + This brings down the timers to 60Hz, the same rate as the events. > > Could this have used DeferrableOneShotTimer? It's a different use case. Just using DeferrableOneShotTimer does not help because we call stop() before each start()/restart(). We could combine DeferrableOneShotTimer with the lazy stop to lower the timer rescheduling to 1 timer / 3 seconds. I like the idea, I add that to my todo list :)
Benjamin Poulain
Comment 12 2019-02-06 18:00:49 PST
Reopening to attach new patch.
Benjamin Poulain
Comment 13 2019-02-06 18:00:49 PST
EWS Watchlist
Comment 14 2019-02-06 18:04:01 PST
Attachment 361354 [details] did not pass style-queue: ERROR: Source/WebCore/platform/Timer.h:153: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 1 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 15 2019-02-06 19:13:17 PST
Comment on attachment 361354 [details] Patch Clearing flags on attachment: 361354 Committed r241113: <https://trac.webkit.org/changeset/241113>
WebKit Commit Bot
Comment 16 2019-02-06 19:13:18 PST
All reviewed patches have been landed. Closing bug.
Simon Fraser (smfr)
Comment 17 2019-02-06 23:06:37 PST
Tim Horton
Comment 18 2019-02-08 23:30:09 PST
The rollout commit says "Some timer uses are done off the main thread" but WebCore::Timer also can't be used in the WK2 UI process because of co-existence with the Web-Thread-enabled WK1.
Benjamin Poulain
Comment 19 2019-02-11 21:10:45 PST
Reopening, the optimization was reverted.
Benjamin Poulain
Comment 20 2019-02-11 21:38:31 PST
EWS Watchlist
Comment 21 2019-02-11 23:27:36 PST
Comment on attachment 361766 [details] Patch Attachment 361766 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/11118407 New failing tests: http/tests/inspector/network/resource-initiatorNode.html
EWS Watchlist
Comment 22 2019-02-11 23:27:37 PST
Created attachment 361773 [details] Archive of layout-test-results from ews115 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-highsierra Platform: Mac OS X 10.13.6
Benjamin Poulain
Comment 23 2019-02-12 00:26:57 PST
Geoffrey Garen
Comment 24 2019-02-12 18:46:48 PST
Comment on attachment 361777 [details] Patch r=me
Benjamin Poulain
Comment 25 2019-02-13 00:15:46 PST
Comment on attachment 361777 [details] Patch (In reply to Geoffrey Garen from comment #24) > Comment on attachment 361777 [details] > Patch > > r=me Thanks for the review!
WebKit Commit Bot
Comment 26 2019-02-13 00:41:27 PST
Comment on attachment 361777 [details] Patch Clearing flags on attachment: 361777 Committed r241351: <https://trac.webkit.org/changeset/241351>
WebKit Commit Bot
Comment 27 2019-02-13 00:41:29 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.