Bug 263096 - Add a ProcessAssertion cache
Summary: Add a ProcessAssertion cache
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-12 16:48 PDT by Chris Dumez
Modified: 2023-10-13 14:55 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2023-10-12 16:48:37 PDT
Add a ProcessAssertion cache to avoid hammering RunningBoard when switching quickly from one assertion type to another (e.g. background <-> foreground).
Taking RunningBoard assertions is expensive and this churn can result in high CPU usage.

We have evidence this can happen for example when we're holding a background assertion on the WebProcess but the client app keeps running JS in the view, causing us to take a foreground assertion for each JS execution request.

We now keep previous assertions around for 3 seconds when switching from one assertion type to another and we reuse them when possible.
Comment 1 Chris Dumez 2023-10-12 16:48:45 PDT
<rdar://113579564>
Comment 2 Chris Dumez 2023-10-12 16:51:08 PDT
Pull request: https://github.com/WebKit/WebKit/pull/19027
Comment 3 EWS 2023-10-13 14:55:53 PDT
Committed 269319@main (f6fade6a9e36): <https://commits.webkit.org/269319@main>

Reviewed commits have been landed. Closing PR #19027 and removing active labels.