Changeset 143137 in webkit


Ignore:
Timestamp:
Feb 17, 2013 3:26:10 PM (11 years ago)
Author:
akling@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143136 r143137  
     12013-02-17  Andreas Kling  <akling@apple.com>
     2
     3        REGRESSION(r143125): ~5% performance hit on Chromium's intl2 page cycler.
     4        <http://webkit.org/b/108835>
     5
     6        Reviewed by Ojan Vafai.
     7
     8        Streamline the case where GlyphPage has a per-glyph SimpleFontData* lookup table to allow
     9        taking earlier branches on pages with lots of mixed-font text.
     10        We accomplish this by explicitly storing a null SimpleFontData* for glyph #0 in the per-glyph
     11        lookup table instead of relying on "if (!glyph)" checks in getters.
     12
     13        This is a speculative optimization, I can't get stable enough numbers locally to tell if this
     14        will resolve the issue on the bots.
     15
     16        * platform/graphics/GlyphPage.h:
     17        (WebCore::GlyphPage::glyphDataForIndex):
     18        (WebCore::GlyphPage::fontDataForCharacter):
     19        (WebCore::GlyphPage::setGlyphDataForIndex):
     20
    1212013-02-17  Chris Fleizach  <cfleizach@apple.com>
    222
  • trunk/Source/WebCore/platform/graphics/GlyphPage.h

    r143125 r143137  
    104104        ASSERT_WITH_SECURITY_IMPLICATION(index < size);
    105105        Glyph glyph = m_glyphs[index];
     106        if (m_perGlyphFontData)
     107            return GlyphData(glyph, m_perGlyphFontData[index]);
    106108        if (!glyph)
    107109            return GlyphData(0, 0);
    108         if (m_perGlyphFontData)
    109             return GlyphData(glyph, m_perGlyphFontData[index]);
    110110        return GlyphData(glyph, m_fontDataForAllGlyphs);
    111111    }
     
    119119    const SimpleFontData* fontDataForCharacter(UChar32 c) const
    120120    {
    121         return glyphDataForIndex(indexForCharacter(c)).fontData;
     121        unsigned index = indexForCharacter(c);
     122        if (m_perGlyphFontData)
     123            return m_perGlyphFontData[index];
     124        Glyph glyph = m_glyphs[index];
     125        if (!glyph)
     126            return 0;
     127        return m_fontDataForAllGlyphs;
    122128    }
    123129
     
    132138        m_glyphs[index] = glyph;
    133139
    134         // GlyphPage getters will always return a null SimpleFontData* for glyph #0, so don't worry about the pointer for them.
     140        // GlyphPage getters will always return a null SimpleFontData* for glyph #0 if there's no per-glyph font array.
     141        if (m_perGlyphFontData) {
     142            m_perGlyphFontData[index] = glyph ? fontData : 0;
     143            return;
     144        }
     145
    135146        if (!glyph)
    136147            return;
     
    138149        // A glyph index without a font data pointer makes no sense.
    139150        ASSERT(fontData);
    140 
    141         if (m_perGlyphFontData) {
    142             m_perGlyphFontData[index] = fontData;
    143             return;
    144         }
    145151
    146152        if (!m_fontDataForAllGlyphs)
     
    154160        m_perGlyphFontData = static_cast<const SimpleFontData**>(fastMalloc(size * sizeof(SimpleFontData*)));
    155161        for (unsigned i = 0; i < size; ++i)
    156             m_perGlyphFontData[i] = oldFontData;
     162            m_perGlyphFontData[i] = m_glyphs[i] ? oldFontData : 0;
    157163        m_perGlyphFontData[index] = fontData;
    158164    }
Note: See TracChangeset for help on using the changeset viewer.