-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebCore] Optimize Font::applyTransforms
https://bugs.webkit.org/show_bug.cgi?id=270406 rdar://123961009 Reviewed by Chris Dumez. Font::applyTransforms is very slow. While the most of time is used in CoreText, the other part is also using much time! This patch optimizes it. 1. We add Vector::insertFill function to insert one-item-filling into Vector. GlyphBuffer is doing this in a very inefficient way right now: allocating filled Vector and using insertVector. 2. Add size parameter to upconvertedCharacters and use 256 for static Vector size in Font::applyTransforms, to avoid unnecessary allocations. 3. LocaleCocoa::canonicalLanguageIdentifierFromString should return RetainPtr<CFStringRef>. We found that we are super repeatedly creating CFString when locale is specified because canonicalLanguageIdentifierFromString returns AtomString and we convert it to CFString. And this is very slow. Because canonicalLanguageIdentifierFromString is only used in this place, we should just return RetainPtr<CFStringRef>. Also we optimized the caching mechanism in canonicalLanguageIdentifierFromString to cache the one item out of HashMap since this one-item cache can cover almost all cases. * Source/WTF/wtf/Vector.h: (WTF::Malloc>::insertFill): * Source/WTF/wtf/text/StringView.h: (WTF::StringView::upconvertedCharacters const): (WTF::StringView::UpconvertedCharacters<N>::UpconvertedCharacters): (WTF::StringView::UpconvertedCharacters::UpconvertedCharacters): Deleted. * Source/WebCore/editing/TextIterator.cpp: * Source/WebCore/platform/graphics/GlyphBuffer.h: (WebCore::GlyphBuffer::makeHole): * Source/WebCore/platform/graphics/coretext/FontCoreText.cpp: (WebCore::Font::applyTransforms const): * Source/WebCore/platform/text/cocoa/LocaleCocoa.h: * Source/WebCore/platform/text/cocoa/LocaleCocoa.mm: (WebCore::localeCache): (WebCore::LocaleCocoa::canonicalLanguageIdentifierFromString): (WebCore::LocaleCocoa::releaseMemory): (WebCore::canonicalLocaleMap): Deleted. Canonical link: https://commits.webkit.org/275676@main
- Loading branch information
1 parent
bc31443
commit 4e349ca
Showing
8 changed files
with
95 additions
and
29 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
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
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
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