[Cocoa] Improve performance of populating glyph caches in the fast text codepath
Created attachment 288424 [details] WIP
Created attachment 288430 [details] WIP
Attachment 288430 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:80: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 2 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 288445 [details] WIP
Attachment 288445 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:109: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 2 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 288446 [details] WIP
Attachment 288446 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:110: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 2 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 288470 [details] WIP
Created attachment 288489 [details] WIP
Created attachment 288496 [details] ASSERTs testing
Created attachment 288497 [details] Measuring perf
Created attachment 288555 [details] No regression
Created attachment 288577 [details] Patch
Comment on attachment 288577 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288577&action=review > Source/WTF/wtf/unicode/CharacterNames.h:73 > +const UChar narrowNoBreakSpace = 0x202F; Please add this definitions such that it appears in this list of definitions in sorted order according to the UNIX sort command. > Source/WTF/wtf/unicode/CharacterNames.h:136 > +using WTF::Unicode::narrowNoBreakSpace; Ditto. > Source/WebCore/platform/graphics/GlyphPage.h:45 > + GlyphData(Glyph glyph = 0, const Font* font = 0) We should take this opportunity to change 0 to nullptr for the default value of the second argument. > Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:43 > +static bool shouldFillWithVerticalGlyphs(const UChar* buffer, unsigned bufferLength, const Font& font) We may want to consider having this function take a WTF::StringView (or maybe introduce a WTF::ArrayView) instead of passing a buffer and length. Among other benefits, using a WTF::StringView helps ensure that we always have the correct buffer length for the buffer. I know that currently the caller GlyphPage::fill() is passed a raw pointer to a buffer and a length. We may want to look to change these signatures as well. > Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:49 > + if (!font.hasVerticalGlyphs()) > + return false; > + for (unsigned i = 0; i < bufferLength; ++i) { > + if (!FontCascade::isCJKIdeograph(buffer[i])) > + return true; I am assuming that we no longer need to consider whether the font is a system font or the font is for text combine as part of knowing whether a font has vertical glyphs.
Comment on attachment 288577 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288577&action=review >> Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:43 >> +static bool shouldFillWithVerticalGlyphs(const UChar* buffer, unsigned bufferLength, const Font& font) > > We may want to consider having this function take a WTF::StringView (or maybe introduce a WTF::ArrayView) instead of passing a buffer and length. Among other benefits, using a WTF::StringView helps ensure that we always have the correct buffer length for the buffer. I know that currently the caller GlyphPage::fill() is passed a raw pointer to a buffer and a length. We may want to look to change these signatures as well. StringView is not a good candidate because it can hold both 8-bit characters and 16-bit characters, but this function only accepts 16-bit characters. Something like an ArrayView would be a better fit, but I think implementing that is out of scope for this patch. >> Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp:49 >> + return true; > > I am assuming that we no longer need to consider whether the font is a system font or the font is for text combine as part of knowing whether a font has vertical glyphs. In the (deleted) code below, we only call CTFontGetVerticalGlyphsForCharacters() if the font is not a system font and the font is not for text combine.
Committed r205826: <http://trac.webkit.org/changeset/205826>