Bug 53649

Summary: move-left-right.html and extend-selection-*.html are slow
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Enhancement CC: darin, enrica, eric, justin.garcia, leviw, mitz, xji
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
extend-selection* profile
none
move-left-right profile
none
extend-selection* profile
none
move-left-right profile none

Description Ryosuke Niwa 2011-02-02 17:16:51 PST
According to the bug 27995, the two slowest tests are from editing/selection.

9.58 secs: editing/selection/move-left-right.html
9.37 secs: fast/js/array-filter.html
7.71 secs: editing/selection/extend-selection.html

We should improve the performance.
Comment 1 Ryosuke Niwa 2011-02-02 17:19:25 PST
Created attachment 81009 [details]
extend-selection* profile

It seems like the most time is spent in ICU and isContentEditable.
Comment 2 Ryosuke Niwa 2011-02-02 17:32:35 PST
Created attachment 81011 [details]
move-left-right profile
Comment 3 Ryosuke Niwa 2011-02-02 17:33:09 PST
It seems like ICU and isContentEditable is hot again:

	5.6%	5.6%	libicucore.A.dylib	icu::RuleBasedBreakIterator::handleNext(icu::RBBIStateTable const*)
	0.0%	5.6%	libicucore.A.dylib	 icu::RuleBasedBreakIterator::next()
	0.0%	4.4%	libicucore.A.dylib	  icu::RuleBasedBreakIterator::previous()
	0.0%	3.1%	WebCore	   WebCore::RenderText::previousOffset(int) const
	0.0%	1.1%	WebCore	    WebCore::Position::inRenderedText() const
	0.0%	1.1%	WebCore	     WebCore::Position::isCandidate() const
	0.0%	1.1%	WebCore	    WebCore::PositionIterator::decrement()
	0.0%	1.1%	WebCore	     WebCore::Position::upstream(WebCore::EditingBoundaryCrossingRule) const
	0.0%	0.9%	WebCore	    WebCore::Position::previous(WebCore::PositionMoveType) const
	0.0%	0.9%	WebCore	     WebCore::previousVisuallyDistinctCandidate(WebCore::Position const&)
	0.0%	1.3%	libicucore.A.dylib	   icu::RuleBasedBreakIterator::following(int)
	0.0%	1.3%	WebCore	    WebCore::RenderText::nextOffset(int) const
	0.0%	0.9%	WebCore	     WebCore::Position::inRenderedText() const
	0.0%	0.4%	WebCore	     WebCore::PositionIterator::increment()
	0.0%	0.1%	WebCore	     WebCore::Position::next(WebCore::PositionMoveType) const
	0.0%	1.0%	libicucore.A.dylib	  icu::RuleBasedBreakIterator::following(int)
	0.0%	0.1%	WebCore	  WebCore::RenderText::nextOffset(int) const
	0.0%	0.1%	CoreFoundation	  CFStringTokenizerAdvanceToNextToken
	5.4%	5.4%	libobjc.A.dylib	objc_msgSend
	0.0%	1.5%	WebKit	 WebEditorClient::isEditable()
	0.0%	1.5%	WebCore	  WebCore::Editor::clientIsEditable() const
	0.0%	1.5%	WebCore	   WebCore::Frame::isContentEditable() const
	0.0%	1.5%	WebCore	    WebCore::HTMLElement::isContentEditable() const
Comment 4 Ryosuke Niwa 2011-02-03 02:07:24 PST
It seems like we need to make Node::isContentEditable and Element::isContentEditable non-virtual inline function.  They are called way too frequently to be virtual.
Comment 5 Ryosuke Niwa 2011-03-08 20:13:11 PST
Now that the bug 54050 has been fixed, I'll resample.
Comment 6 Ryosuke Niwa 2011-03-11 02:08:15 PST
Created attachment 85450 [details]
extend-selection* profile
Comment 7 Ryosuke Niwa 2011-03-11 02:08:56 PST
Created attachment 85451 [details]
move-left-right profile