FontFallbackList: Glyph pages waste a lot of memory.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2011 16:50:53 +0000 (16:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2011 16:50:53 +0000 (16:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69260

Patch by Andreas Kling <kling@webkit.org> on 2011-10-03
Reviewed by Dan Bernstein.

Use a minimum hash table size of 16 (down from 64) for FontFallbackList's
glyph pages. This reduces memory consumption by ~900 kB when loading the
full HTML5 spec.

The cost is two additional rehash()es of FontFallbackList::m_pages when
adding the 32nd and 64th pages to the hash map.

* platform/graphics/FontFallbackList.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontFallbackList.h

index baa4773..589419a 100644 (file)
@@ -1,3 +1,19 @@
+2011-10-03  Andreas Kling  <kling@webkit.org>
+
+        FontFallbackList: Glyph pages waste a lot of memory.
+        https://bugs.webkit.org/show_bug.cgi?id=69260
+
+        Reviewed by Dan Bernstein.
+
+        Use a minimum hash table size of 16 (down from 64) for FontFallbackList's
+        glyph pages. This reduces memory consumption by ~900 kB when loading the
+        full HTML5 spec.
+
+        The cost is two additional rehash()es of FontFallbackList::m_pages when
+        adding the 32nd and 64th pages to the hash map.
+
+        * platform/graphics/FontFallbackList.h:
+
 2011-10-03  Konstantin Scheglov  <scheglov@google.com>
 
         Right border missing from table with colspan and collapsing border
index 459baba..072033f 100644 (file)
@@ -53,7 +53,10 @@ public:
     FontSelector* fontSelector() const { return m_fontSelector.get(); }
     unsigned generation() const { return m_generation; }
 
-    typedef HashMap<int, GlyphPageTreeNode*> GlyphPages;
+    struct GlyphPagesHashTraits : HashTraits<int> {
+        static const int minimumTableSize = 16;
+    };
+    typedef HashMap<int, GlyphPageTreeNode*, DefaultHash<int>::Hash, GlyphPagesHashTraits> GlyphPages;
     GlyphPageTreeNode* glyphPageZero() const { return m_pageZero; }
     const GlyphPages& glyphPages() const { return m_pages; }