Closed Bug 1304883 Opened 9 years ago Closed 9 years ago

Reduce MainThreadInvoker latency

Categories

(Core :: Widget: Win32, defect)

Unspecified
Windows
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: bugzilla, Assigned: bugzilla)

References

Details

Attachments

(1 file)

Since a11y+e10s is using ALPC, we want the handoff from the background RPC thread to the main thread to be done as cheaply as possible, thus ensuring that we don't lose performance due to the handoff. Posting runnables to the main thread to execute NtTestAlert adds too much latency to MainThreadInvoker as it needs to take two mutexes and then go through the Windows message queue to get that call inserted. I've been able to improve a11y+e10s performance scores on both Talos and locally by modifying this code so that, once an APC has been enqueued, we set an atomic boolean. Whenever the widget is about to do a PeekMessage, or whenever an APC has woken the widget from a wait, we check that flag and, if it was set, we then clear the entire APC queue.
Attached patch PatchSplinter Review
Assignee: nobody → aklotz
Status: NEW → ASSIGNED
Attachment #8793947 - Flags: review?(jmathies)
Comment on attachment 8793947 [details] [diff] [review] Patch Review of attachment 8793947 [details] [diff] [review]: ----------------------------------------------------------------- ::: widget/windows/WinUtils.cpp @@ +723,5 @@ > UINT aLastMessage, UINT aOption) > { > +#ifdef ACCESSIBILITY > + if (NS_IsMainThread() && sAPCPending.exchange(false)) { > + while (sNtTestAlert() != STATUS_SUCCESS) ; why do we need to call this repetitively?
Attachment #8793947 - Flags: review?(jmathies) → review+
(In reply to Jim Mathies [:jimm] from comment #2) > why do we need to call this repetitively? NtTestAlert doesn't clear out the entire APC queue, just the head. If there is more than one APC we want to service all of them.
https://hg.mozilla.org/integration/mozilla-inbound/rev/c9e65e3bf84a6229e79c1a0246a99b54a426f262 Bug 1304883: Modify mscom::MainThreadInvoker and Win32 widget to use atomic boolean to flag pending APCs; r=jimm
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Depends on: 1306014
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: