Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4eacd1576afcd0b9f9c083aea8faeef60564dd49
https://github.com/WebKit/WebKit/commit/4eacd1576afcd0b9f9c083aea8faeef60564dd49
Author: Nathan Solomon <[email protected]>
Date: 2025-10-13 (Mon, 13 Oct 2025)
Changed paths:
A LayoutTests/fast/parser/html-fast-path-whitespace-caching-expected.txt
A LayoutTests/fast/parser/html-fast-path-whitespace-caching.html
M Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp
Log Message:
-----------
Add caching for whitespace strings in HTMLFastPathParser
https://bugs.webkit.org/show_bug.cgi?id=299919
rdar://161694563
Reviewed by Ryan Reno.
The fast path parser takes up a significant percentage of the work in SP3.
It has high memory demand, mainly due to the allocation of DOM nodes,
but ~14% of the memory demand is spent in the String constructor.
Add a cache of pre allocated Strings that are newline char + some number
of space characters to use while parsing instead of dynamically allocating
the string for the text node.
This cache shows with local testing to improve memory demand of the fast path
parser by 14%.
A/B testing shows this patch is perf neutral to 1-2% improvement in
TODOMVC-JQuery.
This patch was heavily influenced by Blink's fast path parser which
has the same optomization
Test: fast/parser/html-fast-path-whitespace-caching.html
* LayoutTests/fast/parser/html-fast-path-whitespace-caching-expected.txt: Added.
* LayoutTests/fast/parser/html-fast-path-whitespace-caching.html: Added.
* Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp:
(NewlineThenWhitespaceStringsTable::getCachedWhitespace):
(NewlineThenWhitespaceStringsTable::whitespaceStringCache):
(WebCore::HTMLFastPathParser::ScanTextResult::tryUseWhitespaceCache const):
(WebCore::HTMLFastPathParser::scanText):
(WebCore::HTMLFastPathParser::parseChildren):
Canonical link: https://commits.webkit.org/301416@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes