Regression(r450370): document.execCommand("insertHTML") with nested <span> is really slow |
|||
Issue descriptionThe attached example went from ~20ms to ~125ms after r450370. The example creates a <p> with 100 nested <span> elements, and inserts its using document.execCommand("insertHTML"); If you add more spans like 200, then the difference is much bigger. Some Microsoft Word documents generates this kind of HTML when copying the whole document (even if it's a small document just one page), pasting them on contenteditable is really slow. I did a bisect and the range was: https://chromium.googlesource.com/chromium/src/+log/f63ac52a3a74c9856d6fead1b1fb26a4948b35fe..d892f9592860691ae9a782c12260c94ed6bd1a63 So I believe the culprit is: https://chromium.googlesource.com/chromium/src/+/d892f9592860691ae9a782c12260c94ed6bd1a63
,
Oct 30
It seems ReplaceSelectionCommand::RemoveRedundantStylesAndKeepStyleSpanInline() consumes 82% of execution time due for creating VisibleSelection and VisiblePosition.
,
Oct 30
,
Oct 30
I didn't investigate this deeper but removing the call to RemoveNodePreservingChildren() in ReplaceSelectionCommand::RemoveRedundantStylesAndKeepStyleSpanInline() gets much better results: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/editing/commands/replace_selection_command.cc?q=RemoveNodePreservingChildren&sq=package:chromium&dr=CSs&l=622 I know that we cannot simply remove this line, but it seems clear that this line is adding a big overhead. |
|||
►
Sign in to add a comment |
|||
Comment 1 by r...@igalia.com
, Oct 22