Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Issue 2034023003: Make appendChild/insertBefore faster with active ranges (Closed)

Created:
4 years, 6 months ago by yosin_UTC9
Modified:
4 years, 6 months ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make appendChild/insertBefore faster with active Range objects This patch makes |Node#appendChild()| and |Node#insertBefore()| faster when there are active Range objects in document. Before this path, we iterate over all active |Range| objects to make there cached offset invalid for each |appendChild()| and |insertBefore()|. From this patch, we use both DOM tree version and invalid value of |m_offsetInContainer| as invalid offset marker to avoid iterating over all active |Range| objects. This makes execution of speed of |appendChild()| and |insertBefore()| independent from number of active |Range| objects. On my Linux box, "append-child-with-ranges.html" (with 100 |Range| objects) results are: w/patch: avg 13.4ms, median 14 ms, min 10ms, max 21ms w/o patch: avg 42.1ms, median 42ms, min 38ms, max 49ms Note: This patch is inspired by esphren@'s comments regarding to crbug/613658 and based on kouhei@'s great idea and strong push. BUG=n/a TEST=PerformanceTests/Mutation/append-child-with-ranges.html Committed: https://crrev.com/023a90124852ea2ceab04d4a5662e1dcb5caba68 Cr-Commit-Position: refs/heads/master@{#397987}

Patch Set 1 : 2016-06-03T18:48:37 #

Total comments: 8

Patch Set 2 : 2016-06-06T14:17:03 Adopt for review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+91 lines, -11 lines) Patch
A third_party/WebKit/PerformanceTests/Mutation/append-child-with-ranges.html View 1 1 chunk +29 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ContainerNode.h View 1 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ContainerNode.cpp View 1 1 chunk +9 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/Range.cpp View 3 chunks +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h View 1 11 chunks +48 lines, -10 lines 0 comments Download

Messages

Total messages: 11 (5 generated)
kouhei (in TOK)
lgtm % nits https://codereview.chromium.org/2034023003/diff/1/third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h File third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h (right): https://codereview.chromium.org/2034023003/diff/1/third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h#newcode141 third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h:141: const_cast<RangeBoundaryPoint*>(this)->ensureOffsetIsValid(); this const_cast shouldn't be needed ...
4 years, 6 months ago (2016-06-04 05:00:36 UTC) #3
keishi
LGTM https://codereview.chromium.org/2034023003/diff/1/third_party/WebKit/PerformanceTests/Mutation/append-child-with-ranges.html File third_party/WebKit/PerformanceTests/Mutation/append-child-with-ranges.html (right): https://codereview.chromium.org/2034023003/diff/1/third_party/WebKit/PerformanceTests/Mutation/append-child-with-ranges.html#newcode2 third_party/WebKit/PerformanceTests/Mutation/append-child-with-ranges.html:2: <!-- Identical to "append-child.html" but having 10,000 active ...
4 years, 6 months ago (2016-06-04 07:02:45 UTC) #4
yosin_UTC9
Thanks for review! I updated CL as review comments. Committing... https://codereview.chromium.org/2034023003/diff/1/third_party/WebKit/PerformanceTests/Mutation/append-child-with-ranges.html File third_party/WebKit/PerformanceTests/Mutation/append-child-with-ranges.html (right): https://codereview.chromium.org/2034023003/diff/1/third_party/WebKit/PerformanceTests/Mutation/append-child-with-ranges.html#newcode2 ...
4 years, 6 months ago (2016-06-06 05:21:27 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2034023003/20001
4 years, 6 months ago (2016-06-06 05:21:34 UTC) #8
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 6 months ago (2016-06-06 06:48:41 UTC) #9
commit-bot: I haz the power
4 years, 6 months ago (2016-06-06 06:50:28 UTC) #11
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/023a90124852ea2ceab04d4a5662e1dcb5caba68
Cr-Commit-Position: refs/heads/master@{#397987}

Powered by Google App Engine
This is Rietveld 408576698