Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3d942e9a3f19ad2c6f7a32cc8c084eeb6359dd3b
https://github.com/WebKit/WebKit/commit/3d942e9a3f19ad2c6f7a32cc8c084eeb6359dd3b
Author: Nathan Solomon <[email protected]>
Date: 2026-04-16 (Thu, 16 Apr 2026)
Changed paths:
M Source/WebCore/layout/LayoutState.cpp
M Source/WebCore/layout/LayoutState.h
M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
M Source/WebCore/rendering/RenderBlockFlow.cpp
M Source/WebCore/rendering/RenderBlockFlow.h
Log Message:
-----------
Optimize InlineContentCache destruction by moving InlineContentCache from
LayoutState HashMap to RenderBlockFlow
https://bugs.webkit.org/show_bug.cgi?id=311959
rdar://174512361
Reviewed by Antti Koivisto and Alan Baradlay.
LayoutState stores InlineContentCache in a HashMap keyed by
CheckedRef. Profiling shows that destruction of this hash map is
a significant contributor to ~LineLayout destruction time.
Destruction requires indexing into the map, then the removal of an entry that
can trigger
a shrink/rehash, walking the entries with CheckedRef
decrements on each key.
Move the InlineContentCache to a unique_ptr member on
RenderBlockFlow. The cache is destroyed with the renderer, so no
explicit hash table removal is needed, which benefits performance at the
tradeoff of making RenderBlockFlow 8 bytes bigger.
A/B testing shows this is a small performance improvement.
No new tests since behavior should not change and does not cause
any expected, testable behavior.
* Source/WebCore/layout/LayoutState.cpp:
(WebCore::Layout::LayoutState::inlineContentCache):
(WebCore::Layout::LayoutState::destroyInlineContentCache): Deleted.
* Source/WebCore/layout/LayoutState.h:
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::~LineLayout):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::ensureInlineContentCache):
(WebCore::RenderBlockFlow::resetInlineContentCache):
* Source/WebCore/rendering/RenderBlockFlow.h:
Canonical link: https://commits.webkit.org/311408@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications