Bug 119927
| Summary: | Improve compositor hit testing performance by using layer bounding boxes | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> |
| Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | benjamin, dino, hyatt, kling, koivisto, simon.fraser, tonikitoo |
| Priority: | P2 | Keywords: | BlinkMergeCandidate |
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Ryosuke Niwa
Consider merging https://chromium.googlesource.com/chromium/blink/+/9b84937654c1610c7c7e45f6c3a8022336f08fe0
or come up with a better optimization
In complex sites, the bulk of the time spent computing hit test rects is in walking
the render tree and updating the list of rects. We can avoid much of this by
switching to walking the RenderLayer tree once we want to track all the objects in
a layer. In practice the bounding box of a layer appears to be pretty close to
the union of all the rects contained in it (a bit of an overestimate is OK).
For one of my worst-case testcases (newegg.com), this improves performance by about 3x
(going from about 1.1ms to 0.4ms on my fast desktop). Performance is also improved
in many other non-trivial scenarios.
This also includes another optimzation where we avoid processing a touch handler
when one of it's ancestor nodes also has a handler. This way we can avoid processing the same portion of the render tree more than once and avoid potential pathological cases which could be extremely expensive. This improved performance of another one of my worst-cases by 25% (games.yahoo.com - from 2.0ms to 1.6ms).
This also fixes an edge case around handlers on overflow-scroll elements with
borders. The border (not being part of the scroll content) didn't get covered
previously.
This also removes a related TRACE I accidentally put on a recursive function which just clutters up the trace (cpu profiling is necessary for any real breakdown of the cost anyway).
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |