Bug 65377 - Hidden text nodes slow down position traversing
Summary: Hidden text nodes slow down position traversing
Status: RESOLVED LATER
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P3 Normal
Assignee: Yong Li
URL:
Keywords:
Depends on: 77027
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-29 08:00 PDT by Yong Li
Modified: 2012-01-25 11:00 PST (History)
11 users (show)

See Also:


Attachments
the test case (516 bytes, text/html)
2011-07-29 08:00 PDT, Yong Li
no flags Details
proposed patch (5.31 KB, patch)
2011-07-29 08:21 PDT, Yong Li
no flags Details | Formatted Diff | Diff
proposed patch again (5.34 KB, patch)
2011-07-29 08:40 PDT, Yong Li
no flags Details | Formatted Diff | Diff
With a test case (7.65 KB, patch)
2011-08-24 10:54 PDT, Yong Li
no flags Details | Formatted Diff | Diff
The patch with test case (8.45 KB, patch)
2011-08-24 11:00 PDT, Yong Li
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
the patch (8.55 KB, patch)
2011-08-24 12:01 PDT, Yong Li
darin: review+
darin: commit-queue-
Details | Formatted Diff | Diff
Fix the change log (8.40 KB, patch)
2012-01-25 08:37 PST, Yong Li
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yong Li 2011-07-29 08:00:01 PDT
Created attachment 102361 [details]
the test case

When WebKit traverses positions, it wastes CPU time on hidden text nodes.

Open the test case in a WebKit browser, click the blank area on the left of the visible text, you will see the page doesn't respond for text selection any more. This is because WebKit is busy in traversing hidden text nodes.

The test case doesn't exist in real world. However pages with hidden text do exist in real world, and if we fix this, we could probably boost selection performance in some cases.
Comment 1 Yong Li 2011-07-29 08:21:13 PDT
Created attachment 102364 [details]
proposed patch

There may be more places we can optimize in Position related code. Is it a correct approach?
Comment 2 WebKit Review Bot 2011-07-29 08:25:04 PDT
Attachment 102364 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/editing/htmlediting.cpp:222:  Declaration has space between type name and * in RenderObject *renderer  [whitespace/declaration] [3]
Source/WebCore/editing/htmlediting.cpp:248:  Declaration has space between type name and * in RenderObject *renderer  [whitespace/declaration] [3]
Total errors found: 2 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Early Warning System Bot 2011-07-29 08:33:51 PDT
Comment on attachment 102364 [details]
proposed patch

Attachment 102364 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/9266519
Comment 4 Antonio Gomes 2011-07-29 08:36:41 PDT
Yong, would you have numbers to share?
Comment 5 Yong Li 2011-07-29 08:40:20 PDT
Created attachment 102367 [details]
proposed patch again
Comment 6 Yong Li 2011-07-29 10:33:57 PDT
(In reply to comment #4)
> Yong, would you have numbers to share?

No numbers. The result is significant with the test case. Without the patch, browser freezes. With the patch, you cannot feel any slowness
Comment 7 Yong Li 2011-07-29 10:37:12 PDT
(In reply to comment #0)
> Created an attachment (id=102361) [details]
> the test case
> 
> When WebKit traverses positions, it wastes CPU time on hidden text nodes.
> 
> Open the test case in a WebKit browser, click the blank area on the left of the visible text, you will see the page doesn't respond for text selection any more. This is because WebKit is busy in traversing hidden text nodes.
> 
> The test case doesn't exist in real world. However pages with hidden text do exist in real world, and if we fix this, we could probably boost selection performance in some cases.

Correction: "click the blank area on the left of..." shouldbe "on the right of"
Comment 8 Darin Adler 2011-07-31 14:37:58 PDT
Comment on attachment 102367 [details]
proposed patch again

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

> Source/WebCore/ChangeLog:10
> +        No new tests because it doesn't fix any layout issue.

We have a layout test system for making performance tests that check that performance has the correct order of magnitude. These tests are in the LayoutTests/perf directory using the Magnitude object. Using that you should be able to make a test that uses giant hidden text nodes to show the massive speedup from this change.
Comment 9 Yong Li 2011-08-03 19:07:05 PDT
Comment on attachment 102367 [details]
proposed patch again

will write a layout test...
Comment 10 Yong Li 2011-08-24 10:54:53 PDT
Created attachment 105019 [details]
With a test case
Comment 11 Yong Li 2011-08-24 10:55:20 PDT
Comment on attachment 105019 [details]
With a test case

forgot to add change log for layouttest
Comment 12 Yong Li 2011-08-24 11:00:55 PDT
Created attachment 105021 [details]
The patch with test case
Comment 13 WebKit Review Bot 2011-08-24 11:10:56 PDT
Comment on attachment 105021 [details]
The patch with test case

Attachment 105021 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/9486175
Comment 14 Collabora GTK+ EWS bot 2011-08-24 11:22:31 PDT
Comment on attachment 105021 [details]
The patch with test case

Attachment 105021 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/9487204
Comment 15 Gyuyoung Kim 2011-08-24 11:34:01 PDT
Comment on attachment 105021 [details]
The patch with test case

Attachment 105021 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/9490139
Comment 16 Early Warning System Bot 2011-08-24 11:34:52 PDT
Comment on attachment 105021 [details]
The patch with test case

Attachment 105021 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/9488190
Comment 17 WebKit Review Bot 2011-08-24 11:40:20 PDT
Comment on attachment 105021 [details]
The patch with test case

Attachment 105021 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/9486194
Comment 18 Yong Li 2011-08-24 12:01:50 PDT
Created attachment 105035 [details]
the patch
Comment 19 Darin Adler 2011-08-24 16:00:42 PDT
Comment on attachment 105035 [details]
the patch

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

> LayoutTests/ChangeLog:13
> +011-08-24  Andrew Scherkus  <scherkus@chromium.org>

Patch deletes the "2" here!

> Source/WebCore/ChangeLog:25
> +011-08-24  Sam Weinig  <sam@webkit.org>

Patch deletes the "2" here!
Comment 20 Darin Adler 2011-08-24 16:16:17 PDT
Comment on attachment 105035 [details]
the patch

There are 8 different code changes here. There is only one test case. Does the test cover all 8 changes? Or do we need to make more test cases to make sure we cover the improvements in all 8?
Comment 21 Yong Li 2011-08-25 13:48:30 PDT
(In reply to comment #20)
> (From update of attachment 105035 [details])
> There are 8 different code changes here. There is only one test case. Does the test cover all 8 changes? Or do we need to make more test cases to make sure we cover the improvements in all 8?

Actually 6 of them can be tested by just manually clicking on the blank area of the page. However I cannot make DRT show the problem by using eventSender to simulate mouse events. So I ended up with using selection, which tests the other 2 changes. I'll give a further try...
Comment 22 Eric Seidel (no email) 2011-12-21 14:32:15 PST
Attachment 105035 [details] was posted by a committer and has review+, assigning to Yong Li for commit.
Comment 23 Yong Li 2012-01-25 08:37:06 PST
Created attachment 123945 [details]
Fix the change log
Comment 24 WebKit Review Bot 2012-01-25 09:24:04 PST
Comment on attachment 123945 [details]
Fix the change log

Clearing flags on attachment: 123945

Committed r105885: <http://trac.webkit.org/changeset/105885>
Comment 25 WebKit Review Bot 2012-01-25 09:24:12 PST
All reviewed patches have been landed.  Closing bug.
Comment 26 Yong Li 2012-01-25 11:00:34 PST
the patch seems obsolete and causes assertions. push this task to later