Improve the performance of FontCascadeDescription's effectiveFamilies
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 May 2018 00:23:24 +0000 (00:23 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 May 2018 00:23:24 +0000 (00:23 +0000)
commit95f421f15af16318671efa445bf02e97da12018a
tree3545fb86a0edd75444bb0f8ccbcea880381f6e34
parent3210be35d6447e7fa28e6ee54eb084a1e3248a08
Improve the performance of FontCascadeDescription's effectiveFamilies
https://bugs.webkit.org/show_bug.cgi?id=184720
PerformanceTests:

Reviewed by Simon Fraser.

This performance test calls SystemFontDatabase::systemFontCascadeList() around 2,000,000 times (before
this patch is applied), which is roughly equivalent to the page we found the performance problem on.
The calling pattern is roughly equivalent in this test.

* Layout/system-ui.html: Added.

Source/WebCore:

<rdar://problem/38970927>

Reviewed by Simon Fraser.

The page that had the performance problem renders many different Chinese characters in system-ui
with only a small number of individual fonts. It turns out we were calling into the system-ui
machinery for each character in order to opportunistically start loading data URLs (see also:
https://bugs.webkit.org/show_bug.cgi?id=175845). These data URLS will never represent the system
font, so we don't need to invoke the system-ui machinery at all.

This patch makes a 92x performance improvement on the associated performance test. This test is
designed to test Chinese text rendered with system-ui.

Performance test: Layout/system-ui.html

* platform/graphics/FontCascadeFonts.cpp:
(WebCore::opportunisticallyStartFontDataURLLoading):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PerformanceTests/ChangeLog
PerformanceTests/Layout/system-ui.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontCascadeFonts.cpp