Bug 213705 - RunLoop::dispatch should only call wakeUp when needed
Summary: RunLoop::dispatch should only call wakeUp when needed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-28 16:05 PDT by Geoffrey Garen
Modified: 2020-07-06 10:16 PDT (History)
9 users (show)

See Also:


Attachments
Patch (1.63 KB, patch)
2020-06-28 16:06 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (4.94 KB, patch)
2020-06-28 16:33 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (2.94 KB, patch)
2020-06-28 21:28 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (2.98 KB, patch)
2020-06-30 21:54 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (7.01 KB, patch)
2020-07-01 21:24 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (8.88 KB, patch)
2020-07-02 15:34 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2020-06-28 16:05:09 PDT
RunLoop::dispatch should only call wakeUp when needed
Comment 1 Geoffrey Garen 2020-06-28 16:06:25 PDT
Created attachment 403013 [details]
Patch
Comment 2 Geoffrey Garen 2020-06-28 16:09:01 PDT
Comment on attachment 403013 [details]
Patch

Oops! I had planned to remove the functionsHandled behavior separately from this patch -- but it's actually not correct until you do both, since functionsHandled is willing to exit without a wakeUp. :(
Comment 3 Geoffrey Garen 2020-06-28 16:33:11 PDT
Created attachment 403014 [details]
Patch
Comment 4 Sam Weinig 2020-06-28 17:23:51 PDT
Comment on attachment 403014 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=403014&action=review

> Source/WTF/ChangeLog:10
> +        RunLoop::wakeUp is super expensive (at least on Darwin platforms). Back
> +        when IndexedDB used RunLoop::dispatch, RunLoop::wakeUp accounted for 15%
> +        of all database lookup time.

Out of interest (and for the historical record) what makes it so expensive?
Comment 5 Geoffrey Garen 2020-06-28 20:03:25 PDT
Most of the cost seemed to be its usage of pthread mutexes.
Comment 6 Sam Weinig 2020-06-28 20:22:36 PDT
(In reply to Geoffrey Garen from comment #5)
> Most of the cost seemed to be its usage of pthread mutexes.

Is "its" here CFRunLoopWakeUp()? Or something we are doing in WTF?
Comment 7 Geoffrey Garen 2020-06-28 21:28:24 PDT
Created attachment 403027 [details]
Patch
Comment 8 Geoffrey Garen 2020-06-28 21:29:09 PDT
> Is "its" here CFRunLoopWakeUp()? Or something we are doing in WTF?

It's CFRunLoopSourceSignal and CFRunLoopWakeUp.
Comment 9 Geoffrey Garen 2020-06-30 21:54:01 PDT
Created attachment 403264 [details]
Patch
Comment 10 Geoffrey Garen 2020-07-01 21:24:48 PDT
Created attachment 403343 [details]
Patch
Comment 11 Geoffrey Garen 2020-07-02 15:34:39 PDT
Created attachment 403408 [details]
Patch
Comment 12 Geoffrey Garen 2020-07-02 16:16:46 PDT
Comment on attachment 403408 [details]
Patch

Looks like EWS is happy now.
Comment 13 EWS 2020-07-06 10:15:54 PDT
Committed r263973: <https://trac.webkit.org/changeset/263973>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403408 [details].
Comment 14 Radar WebKit Bug Importer 2020-07-06 10:16:18 PDT
<rdar://problem/65137000>