[webkit-reviews] review requested: [Bug 7821] Pasting lots of plain text into Mail is slow : [Attachment 7130] patch

bugzilla-request-daemon at opendarwin.org bugzilla-request-daemon at opendarwin.org
Fri Mar 17 03:57:14 PST 2006


Justin Garcia <justin.garcia at apple.com> has asked Maciej Stachowiak
<mjs at apple.com> for review:
Bug 7821: Pasting lots of plain text into Mail is slow
http://bugzilla.opendarwin.org/show_bug.cgi?id=7821

Attachment 7130: patch
http://bugzilla.opendarwin.org/attachment.cgi?id=7130&action=edit

------- Additional Comments from Justin Garcia <justin.garcia at apple.com>
About ~75% of a big plain text paste was a spent in VisiblePosition creation.  


The expensive part of VisiblePosition creation comes after we've found a
candidate for m_deepPosition.  When two different candidates are visually
equivalent, we always want to choose the one that occurs first in the DOM in
order to make VPs canonical.
The replaced code was expensive because it made lots of calls to downstream,
next and previous, which call childNodeCount and childAt, which are O(n) and
should be avoided.

Also replaced the comments above upstream and downstream because 1) they were
"what" comments, not "why" comments, 2) they make the editing code sound scary,
and that discourages people from wanting to working on it and 3) there is no 3.


This patch causes one layout test failure -
fast/text/atsui-pointtooffset-calls-cg.html.  When running that test with the
debugger, I found someone constructs a VP with an offset inside a composed
character.  The offset comes from ATSUI_pointToOffset.	That's a bug.  I should
really be able to assert in VP::init that the passed offset is not inside a
composed character.  I think I'll disable that test and file a bug.

This is a 2.3x speedup.



More information about the webkit-reviews mailing list