NEW 199283
Prewarm font cache with more fonts
https://bugs.webkit.org/show_bug.cgi?id=199283
Summary Prewarm font cache with more fonts
Per Arne Vollan
Reported 2019-06-27 12:48:41 PDT
This is a confirmed improvement in page load time.
Attachments
Patch (2.62 KB, patch)
2019-06-27 12:52 PDT, Per Arne Vollan
no flags
Patch (2.51 KB, patch)
2019-06-28 08:35 PDT, Per Arne Vollan
no flags
Patch (4.51 KB, patch)
2019-07-15 13:18 PDT, Per Arne Vollan
mmaxfield: review+
Patch (4.43 KB, patch)
2019-07-16 11:47 PDT, Per Arne Vollan
no flags
Patch (4.27 KB, patch)
2019-07-16 14:00 PDT, Per Arne Vollan
no flags
Patch (4.25 KB, patch)
2019-07-16 14:04 PDT, Per Arne Vollan
no flags
Patch (2.27 KB, patch)
2019-07-18 16:37 PDT, Per Arne Vollan
no flags
Per Arne Vollan
Comment 1 2019-06-27 12:52:38 PDT
Antti Koivisto
Comment 2 2019-06-27 23:09:04 PDT
Comment on attachment 373046 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=373046&action=review > Source/WebCore/page/ProcessWarming.cpp:82 > + static NeverDestroyed<Vector<String>> families = std::initializer_list<String> { > + "-apple-system"_s, > + "-webkit-standard"_s, > + "sans-serif"_s, > + "system-ui"_s, > + "Arial"_s, > + "Avenir"_s, > + "Helvetica"_s, > + "Helvetica Neue"_s, > + "Hiragino Sans GB"_s, > + "Lucida Grande"_s, > + "PingFang"_s, > + "SF Pro Text"_s, > + "SF Pro Icons"_s, > + "STHeiti"_s, > + "Segoe UI"_s, > + "Times"_s, > + "Times New Roman"_s > + }; There is substantial power and memory cost in warming fonts. The code here runs for every web process and should only warm things that are very likely needed. I don't think this list fits the criteria. With language specific fonts, it looks more like a benchmark hack. I'm not opposed to globally prewarming more fonts but each entry needs to be justified based on real world data, not artificial benchmark scenarios.
Per Arne Vollan
Comment 3 2019-06-28 08:35:07 PDT
Per Arne Vollan
Comment 4 2019-06-28 08:36:46 PDT
(In reply to Antti Koivisto from comment #2) > Comment on attachment 373046 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=373046&action=review > > > Source/WebCore/page/ProcessWarming.cpp:82 > > + static NeverDestroyed<Vector<String>> families = std::initializer_list<String> { > > + "-apple-system"_s, > > + "-webkit-standard"_s, > > + "sans-serif"_s, > > + "system-ui"_s, > > + "Arial"_s, > > + "Avenir"_s, > > + "Helvetica"_s, > > + "Helvetica Neue"_s, > > + "Hiragino Sans GB"_s, > > + "Lucida Grande"_s, > > + "PingFang"_s, > > + "SF Pro Text"_s, > > + "SF Pro Icons"_s, > > + "STHeiti"_s, > > + "Segoe UI"_s, > > + "Times"_s, > > + "Times New Roman"_s > > + }; > > There is substantial power and memory cost in warming fonts. The code here > runs for every web process and should only warm things that are very likely > needed. I don't think this list fits the criteria. With language specific > fonts, it looks more like a benchmark hack. > > I'm not opposed to globally prewarming more fonts but each entry needs to be > justified based on real world data, not artificial benchmark scenarios. Yes, that makes sense. I have uploaded a new patch with a font list consisting of some of the fonts used by the 10 most popular web sites on Alexa top sites. Thanks for reviewing!
Antti Koivisto
Comment 5 2019-06-28 08:52:32 PDT
Is there a radar for this?
Radar WebKit Bug Importer
Comment 6 2019-06-28 08:54:06 PDT
Per Arne Vollan
Comment 7 2019-06-28 08:55:24 PDT
(In reply to Antti Koivisto from comment #5) > Is there a radar for this? I just had one created by the importer.
Sam Weinig
Comment 8 2019-06-29 09:51:41 PDT
Comment on attachment 373118 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=373118&action=review > Source/WebCore/page/ProcessWarming.cpp:71 > + "-apple-system"_s, > + "sans-serif"_s, > + "system-ui"_s, > + "Arial"_s, > + "Helvetica"_s, > + "Helvetica Neue"_s, > + "Segoe UI"_s, It seems wrong to have a very platform specific list like this in non-platform code. This list should probably be moved to WebCore's FontCache so that platforms can override it.
Per Arne Vollan
Comment 9 2019-07-15 13:18:46 PDT
Myles C. Maxfield
Comment 10 2019-07-15 14:54:51 PDT
Comment on attachment 374141 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374141&action=review > Source/WebCore/page/ProcessWarming.cpp:-77 > - // Cache system UI font fallbacks. Almost every web process needs these. > - // Initializing one size is sufficient to warm CoreText caches. Really? Most web content doesn't use system-ui. Where do the uses come from? > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:1644 > + prewarmInfo.fontNamesRequiringSystemFallback = fontFamiliesForPrewarming(); I don't think this is right. We only take the "system fallback" path for the system font. Arial, Helvetica, Helvetica Neue, Times, and Times New Roman would never hit that path. OTOH, it could be that running these CoreText functions ahead-of-time is still helpful regarding the codepath those fonts ::do:: go through. Do we still get the benefit if we move this list to the "seenFamilies" member? "SF Pro Text" shouldn't match any fonts. Are we sure this one is really valuable?
Per Arne Vollan
Comment 11 2019-07-16 11:47:21 PDT
Per Arne Vollan
Comment 12 2019-07-16 14:00:26 PDT
Per Arne Vollan
Comment 13 2019-07-16 14:04:19 PDT
WebKit Commit Bot
Comment 14 2019-07-16 15:18:44 PDT
Comment on attachment 374238 [details] Patch Clearing flags on attachment: 374238 Committed r247498: <https://trac.webkit.org/changeset/247498>
Per Arne Vollan
Comment 15 2019-07-18 16:37:37 PDT
WebKit Commit Bot
Comment 16 2019-07-18 17:07:58 PDT
Comment on attachment 374427 [details] Patch Clearing flags on attachment: 374427 Committed r247626: <https://trac.webkit.org/changeset/247626>
Note You need to log in before you can comment on or make changes to this bug.