New issue
Advanced search Search tips

Issue 602264 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Optimize boundary transition events code path

Project Member Reported by nzolghadr@chromium.org, Apr 11 2016

Issue description

It seems that we are using lot of time when processing transition events like over/out/enter/leave that we may cause some janks on a very deep DOM trees.

https://output.jsbin.com/guhawu

But event if the DOM is not deep there is still some room to improve to reduce the time consumed by Blink so js has more portion of time in a frame.
 

Comment 1 by mustaq@chromium.org, Apr 11 2016

We should make sure the hittest cost is not the dominating factor here. A quick way to confirm this is to just disable all transition events and see what happens.
I commented parts of the code that is related to some calculating of boundaries and the delay did get reduced but not fully disappeared. But in general I'd like to investigate beyond that as well to see if I can eliminate any redundant delays beyond that point or not.

Comment 3 by mustaq@chromium.org, Apr 11 2016

Good find Navid! The EventSender seems to be spending 280ms in my quick tracing (1840ms~2120ms)! And HitTest is only a small part of it!!

Screenshot from 2016-04-11 10:41:47.png
43.9 KB View Download
trace_crbug-602264.json.gz
1.1 MB Download

Comment 4 by mustaq@chromium.org, Apr 11 2016

Note, however, that accroding to httparchive, the average dom depth seems to be ~10, with 97% of the pages having <20:
http://httparchive.org/interesting.php#avgdomdepth
Any optimization that works reasonably for a max depth 30~50 should be acceptable IMO.

This is a tracing log for a tree of depth 30. It is still a considerable amount of time compared to hit testing.
Screenshot from 2016-04-11 12:59:35.png
28.2 KB View Download

Comment 6 by mustaq@chromium.org, Apr 11 2016

Yes, this proves that an improvement here worth the effort. Thanks for the analysis.
Project Member

Comment 7 by bugdroid1@chromium.org, Apr 25 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c49fdc54f02eb0d4fe3ca0faf620ad8d45ac77f7

commit c49fdc54f02eb0d4fe3ca0faf620ad8d45ac77f7
Author: nzolghadr <nzolghadr@chromium.org>
Date: Mon Apr 25 23:23:29 2016

Change finding common ancestor from O(n^2) to O(n)

Changing the method of finding the common ancestor
of two nodes in the boundary transition events from
O(n^2) to O(n).

BUG= 602264 

Review URL: https://codereview.chromium.org/1904453003

Cr-Commit-Position: refs/heads/master@{#389600}

[modify] https://crrev.com/c49fdc54f02eb0d4fe3ca0faf620ad8d45ac77f7/third_party/WebKit/Source/core/input/PointerEventManager.cpp

Status: Fixed (was: Assigned)
Labels: Hotlist-Input-Dev

Sign in to add a comment