[webkit-changes] [WebKit/WebKit] ef0701: Asynchronously delete small DOM nodes
Nathan Solomon
noreply at github.com
Wed Jan 15 09:23:06 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ef070161a369956d0787ffa9e4ae9904e27ee3cf
https://github.com/WebKit/WebKit/commit/ef070161a369956d0787ffa9e4ae9904e27ee3cf
Author: Nathan Solomon <nathan_solomon at apple.com>
Date: 2025-01-15 (Wed, 15 Jan 2025)
Changed paths:
A LayoutTests/fast/dom/gc-dom-tree-async-node-deletion-queue-limit-expected.txt
A LayoutTests/fast/dom/gc-dom-tree-async-node-deletion-queue-limit.html
A LayoutTests/fast/dom/gc-dom-tree-lifetime-shadow-tree-expected.txt
A LayoutTests/fast/dom/gc-dom-tree-lifetime-shadow-tree.html
M LayoutTests/fast/dom/gc-dom-tree-lifetime.html
M LayoutTests/intersection-observer/root-element-deleted.html
M LayoutTests/platform/ios/TestExpectations
M LayoutTests/platform/mac-wk1/TestExpectations
M Source/WebCore/Headers.cmake
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/dom/AsyncNodeDeletionQueue.h
M Source/WebCore/dom/ContainerNode.cpp
M Source/WebCore/dom/ContainerNode.h
M Source/WebCore/dom/ContainerNodeAlgorithms.cpp
M Source/WebCore/dom/ContainerNodeAlgorithms.h
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/page/MemoryRelease.cpp
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/testing/Internals.cpp
M Source/WebCore/testing/Internals.h
M Source/WebCore/testing/Internals.idl
Log Message:
-----------
Asynchronously delete small DOM nodes
https://bugs.webkit.org/show_bug.cgi?id=282249
rdar://137026148
Reviewed by Matthieu Dubet and Ryosuke Niwa.
Make removedChildren DOM nodes get deleted using the Opportunistic Task
Scheduler.
Instead of synchronously deleting removed child nodes upon each call
to removeChildren, keep a strong reference to each child that has been
removed from the DOM tree but has not been deallocated. Remove the
last reference using the Opportunistic Task Scheduler which will call
each node's destructor.
This is an optimization. We see roughly a
.30% - .55% performance improvement.
* LayoutTests/fast/dom/gc-dom-tree-async-node-deletion-queue-limit-expected.txt: Added.
* LayoutTests/fast/dom/gc-dom-tree-async-node-deletion-queue-limit.html: Added.
* LayoutTests/fast/dom/gc-dom-tree-lifetime-shadow-tree-expected.txt: Added.
* LayoutTests/fast/dom/gc-dom-tree-lifetime-shadow-tree.html: Copied from LayoutTests/fast/dom/gc-dom-tree-lifetime.html.
* LayoutTests/fast/dom/gc-dom-tree-lifetime.html:
* LayoutTests/intersection-observer/root-element-deleted.html:
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac-wk1/TestExpectations:
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/AsyncNodeDeletionQueue.h: Added.
(WebCore::AsyncNodeDeletionQueue::addIfSubtreeSizeIsUnderLimit):
(WebCore::AsyncNodeDeletionQueue::deleteNodesNow):
(WebCore::AsyncNodeDeletionQueue::canNodeBeDeletedAsync):
(WebCore::AsyncNodeDeletionQueue::isNodeLikelyLarge):
* Source/WebCore/dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeAllChildrenWithScriptAssertionMaybeAsync):
(WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
(WebCore::ContainerNode::removeNodeWithScriptAssertion):
(WebCore::ContainerNode::replaceAll):
(WebCore::ContainerNode::removeChildren):
(WebCore::ContainerNode::replaceChildren):
* Source/WebCore/dom/ContainerNode.h:
* Source/WebCore/dom/ContainerNodeAlgorithms.cpp:
(WebCore::updateCanDelayNodeDeletion):
(WebCore::notifyNodeRemovedFromDocument):
(WebCore::notifyNodeRemovedFromTree):
(WebCore::notifyChildNodeRemoved):
* Source/WebCore/dom/ContainerNodeAlgorithms.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::removedLastRef):
* Source/WebCore/dom/Document.h:
(WebCore::Document::asyncNodeDeletionQueue):
* Source/WebCore/page/MemoryRelease.cpp:
(WebCore::releaseNoncriticalMemory):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::performOpportunisticallyScheduledTasks):
(WebCore::Page::deleteRemovedNodes):
* Source/WebCore/page/Page.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::executeOpportunisticallyScheduledTasks const):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
Canonical link: https://commits.webkit.org/288944@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list