RESOLVED FIXED 79195
Cache <font face> family lists in CSSValuePool.
https://bugs.webkit.org/show_bug.cgi?id=79195
Summary Cache <font face> family lists in CSSValuePool.
Andreas Kling
Reported 2012-02-21 22:14:48 PST
Legacy content is typically quite heavy on <font face>. Parsing the face attribute to create a list of families is very expensive. We should cache the results of parsing a given attribute value to minimize time spent here.
Attachments
Semidecent patch (6.26 KB, patch)
2012-02-21 22:29 PST, Andreas Kling
koivisto: review+
Andreas Kling
Comment 1 2012-02-21 22:29:02 PST
Created attachment 128130 [details] Semidecent patch
Antti Koivisto
Comment 2 2012-02-21 22:41:15 PST
Comment on attachment 128130 [details] Semidecent patch View in context: https://bugs.webkit.org/attachment.cgi?id=128130&action=review r=me with a mechanism to prevent unlimited pool growth in weird cases. > Source/WebCore/ChangeLog:10 > + HTMLFontElements with "face" attributes are very common in legacy web content. > + Add a String->CSSValue cache for these in CSSValuePool and use it to avoid > + reparsing and recreating duplicate font face values. A word about performance results might be good. > Source/WebCore/css/CSSValuePool.cpp:140 > +PassRefPtr<CSSValueList> CSSValuePool::createFontFaceValue(const AtomicString& string, CSSStyleSheet* contextStyleSheet) > +{ > + RefPtr<CSSValueList>& value = m_fontFaceValueCache.add(string, 0).first->second; > + if (!value) > + value = CSSParser::parseFontFaceValue(string, contextStyleSheet); > + return value; > +} There should be a mechanism to prevent boundless growth in case this gets hits repeatedly with different values. Something similar to what color value pool has should work fine. > Source/WebCore/css/CSSValuePool.h:81 > IntegerValueCache m_percentValueCache; > IntegerValueCache m_numberValueCache; > > + typedef HashMap<AtomicString, RefPtr<CSSValueList> > FontFaceValueCache; > + FontFaceValueCache m_fontFaceValueCache; It would be nice to renames all these Caches to Pools at some point
Andreas Kling
Comment 3 2012-02-21 23:33:36 PST
Note You need to log in before you can comment on or make changes to this bug.