Title: [143137] trunk/Source/WebCore
- Revision
- 143137
- Author
- [email protected]
- Date
- 2013-02-17 15:26:10 -0800 (Sun, 17 Feb 2013)
Log Message
REGRESSION(r143125): ~5% performance hit on Chromium's intl2 page cycler.
<http://webkit.org/b/108835>
Reviewed by Ojan Vafai.
Streamline the case where GlyphPage has a per-glyph SimpleFontData* lookup table to allow
taking earlier branches on pages with lots of mixed-font text.
We accomplish this by explicitly storing a null SimpleFontData* for glyph #0 in the per-glyph
lookup table instead of relying on "if (!glyph)" checks in getters.
This is a speculative optimization, I can't get stable enough numbers locally to tell if this
will resolve the issue on the bots.
* platform/graphics/GlyphPage.h:
(WebCore::GlyphPage::glyphDataForIndex):
(WebCore::GlyphPage::fontDataForCharacter):
(WebCore::GlyphPage::setGlyphDataForIndex):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (143136 => 143137)
--- trunk/Source/WebCore/ChangeLog 2013-02-17 20:57:42 UTC (rev 143136)
+++ trunk/Source/WebCore/ChangeLog 2013-02-17 23:26:10 UTC (rev 143137)
@@ -1,3 +1,23 @@
+2013-02-17 Andreas Kling <[email protected]>
+
+ REGRESSION(r143125): ~5% performance hit on Chromium's intl2 page cycler.
+ <http://webkit.org/b/108835>
+
+ Reviewed by Ojan Vafai.
+
+ Streamline the case where GlyphPage has a per-glyph SimpleFontData* lookup table to allow
+ taking earlier branches on pages with lots of mixed-font text.
+ We accomplish this by explicitly storing a null SimpleFontData* for glyph #0 in the per-glyph
+ lookup table instead of relying on "if (!glyph)" checks in getters.
+
+ This is a speculative optimization, I can't get stable enough numbers locally to tell if this
+ will resolve the issue on the bots.
+
+ * platform/graphics/GlyphPage.h:
+ (WebCore::GlyphPage::glyphDataForIndex):
+ (WebCore::GlyphPage::fontDataForCharacter):
+ (WebCore::GlyphPage::setGlyphDataForIndex):
+
2013-02-17 Chris Fleizach <[email protected]>
WebSpeech: plumb through a method to generate fake speech jobs for testing
Modified: trunk/Source/WebCore/platform/graphics/GlyphPage.h (143136 => 143137)
--- trunk/Source/WebCore/platform/graphics/GlyphPage.h 2013-02-17 20:57:42 UTC (rev 143136)
+++ trunk/Source/WebCore/platform/graphics/GlyphPage.h 2013-02-17 23:26:10 UTC (rev 143137)
@@ -103,10 +103,10 @@
{
ASSERT_WITH_SECURITY_IMPLICATION(index < size);
Glyph glyph = m_glyphs[index];
+ if (m_perGlyphFontData)
+ return GlyphData(glyph, m_perGlyphFontData[index]);
if (!glyph)
return GlyphData(0, 0);
- if (m_perGlyphFontData)
- return GlyphData(glyph, m_perGlyphFontData[index]);
return GlyphData(glyph, m_fontDataForAllGlyphs);
}
@@ -118,7 +118,13 @@
const SimpleFontData* fontDataForCharacter(UChar32 c) const
{
- return glyphDataForIndex(indexForCharacter(c)).fontData;
+ unsigned index = indexForCharacter(c);
+ if (m_perGlyphFontData)
+ return m_perGlyphFontData[index];
+ Glyph glyph = m_glyphs[index];
+ if (!glyph)
+ return 0;
+ return m_fontDataForAllGlyphs;
}
void setGlyphDataForCharacter(UChar32 c, Glyph g, const SimpleFontData* f)
@@ -131,18 +137,18 @@
ASSERT_WITH_SECURITY_IMPLICATION(index < size);
m_glyphs[index] = glyph;
- // GlyphPage getters will always return a null SimpleFontData* for glyph #0, so don't worry about the pointer for them.
+ // GlyphPage getters will always return a null SimpleFontData* for glyph #0 if there's no per-glyph font array.
+ if (m_perGlyphFontData) {
+ m_perGlyphFontData[index] = glyph ? fontData : 0;
+ return;
+ }
+
if (!glyph)
return;
// A glyph index without a font data pointer makes no sense.
ASSERT(fontData);
- if (m_perGlyphFontData) {
- m_perGlyphFontData[index] = fontData;
- return;
- }
-
if (!m_fontDataForAllGlyphs)
m_fontDataForAllGlyphs = fontData;
@@ -153,7 +159,7 @@
const SimpleFontData* oldFontData = m_fontDataForAllGlyphs;
m_perGlyphFontData = static_cast<const SimpleFontData**>(fastMalloc(size * sizeof(SimpleFontData*)));
for (unsigned i = 0; i < size; ++i)
- m_perGlyphFontData[i] = oldFontData;
+ m_perGlyphFontData[i] = m_glyphs[i] ? oldFontData : 0;
m_perGlyphFontData[index] = fontData;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes