Title: [128804] trunk/Source/WebCore
Revision
128804
Author
[email protected]
Date
2012-09-17 14:11:04 -0700 (Mon, 17 Sep 2012)

Log Message

Make CSS.PrefixUsage histogram smaller to save memory
https://bugs.webkit.org/show_bug.cgi?id=96941

Reviewed by Ojan Vafai.

Each bucket costs about 12 bytes. This reduces the size of the histogram
from 600 to 384, which will save about 2.5k per renderer and browser
process.

In the long run, we could probably generate a table in makeprop.pl that
only has the webkit prefix values to save even more memory (there are
194 properties that start with -webkit).

No new tests, just refactoring.

* css/CSSParser.cpp:
(WebCore::cssPropertyID):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (128803 => 128804)


--- trunk/Source/WebCore/ChangeLog	2012-09-17 21:04:56 UTC (rev 128803)
+++ trunk/Source/WebCore/ChangeLog	2012-09-17 21:11:04 UTC (rev 128804)
@@ -1,3 +1,23 @@
+2012-09-17  Tony Chang  <[email protected]>
+
+        Make CSS.PrefixUsage histogram smaller to save memory
+        https://bugs.webkit.org/show_bug.cgi?id=96941
+
+        Reviewed by Ojan Vafai.
+
+        Each bucket costs about 12 bytes. This reduces the size of the histogram
+        from 600 to 384, which will save about 2.5k per renderer and browser
+        process.
+
+        In the long run, we could probably generate a table in makeprop.pl that
+        only has the webkit prefix values to save even more memory (there are
+        194 properties that start with -webkit).
+
+        No new tests, just refactoring.
+
+        * css/CSSParser.cpp:
+        (WebCore::cssPropertyID):
+
 2012-09-17  Rob Buis  <[email protected]>
 
         [BlackBerry] Enable VIDEO_TRACK

Modified: trunk/Source/WebCore/css/CSSParser.cpp (128803 => 128804)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-09-17 21:04:56 UTC (rev 128803)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-09-17 21:11:04 UTC (rev 128804)
@@ -10418,13 +10418,13 @@
     const Property* hashTableEntry = findProperty(name, length);
     const CSSPropertyID propertyID = hashTableEntry ? static_cast<CSSPropertyID>(hashTableEntry->id) : CSSPropertyInvalid;
 
-    // 600 is comfortably larger than numCSSProperties to allow for growth
-    static const int CSSPropertyHistogramSize = 600;
-    COMPILE_ASSERT(CSSPropertyHistogramSize > numCSSProperties, number_of_css_properties_exceed_CSSPropertyHistogramSize);
+    static const int cssPropertyHistogramSize = numCSSProperties;
+    if (hasPrefix(buffer, length, "-webkit-") && propertyID != CSSPropertyInvalid) {
+        int histogramValue = propertyID - firstCSSProperty;
+        ASSERT(0 <= histogramValue && histogramValue < cssPropertyHistogramSize);
+        HistogramSupport::histogramEnumeration("CSS.PrefixUsage", histogramValue, cssPropertyHistogramSize);
+    }
 
-    if (hasPrefix(buffer, length, "-webkit-") && propertyID != CSSPropertyInvalid)
-        HistogramSupport::histogramEnumeration("CSS.PrefixUsage", max(1, propertyID - firstCSSProperty), CSSPropertyHistogramSize);
-
     return propertyID;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to