DescriptionMake 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 #
Messages
Total messages: 11 (5 generated)
|