Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r231187 - Improve the performance of FontCascadeDescription's e…
…ffectiveFamilies 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):
- Loading branch information
1 parent
b6e6671
commit fe01ed8
Showing
4 changed files
with
73 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="../resources/runner.js"></script> | ||
</head> | ||
<body> | ||
<div id="target" style="width: 300px; display: none; font: 42px 'system-ui', '-apple-system';" lang="zh-CN"></div> | ||
<script> | ||
var target = document.getElementById("target"); | ||
var style = target.style; | ||
|
||
var s = ""; | ||
var length = 10000; | ||
var startCode = 0x4E00; | ||
for (var i = 0; i < length; ++i) { | ||
s = s + String.fromCharCode(i + startCode); | ||
} | ||
|
||
|
||
function test() { | ||
if (window.internals) | ||
window.internals.invalidateFontCache(); | ||
|
||
style.display = "block"; | ||
target.offsetLeft; | ||
target.textContent = s; | ||
target.offsetLeft; | ||
target.textContent = ""; | ||
style.display = "none"; | ||
} | ||
|
||
PerfTestRunner.measureRunsPerSecond({ run: test }); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters