Title: [233148] trunk/Source/WebCore
Revision
233148
Author
simon.fra...@apple.com
Date
2018-06-25 08:57:11 -0700 (Mon, 25 Jun 2018)

Log Message

AutoTableLayout wastes 52KB of Vector capacity on nytimes.com
https://bugs.webkit.org/show_bug.cgi?id=186710

Reviewed by Zalan Bujtas.

Call resizeToFit() to only allocate enough capacity for the number of columns.

* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::fullRecalc):
(WebCore::AutoTableLayout::insertSpanCell): Whitespace fix.
* rendering/AutoTableLayout.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233147 => 233148)


--- trunk/Source/WebCore/ChangeLog	2018-06-25 15:38:03 UTC (rev 233147)
+++ trunk/Source/WebCore/ChangeLog	2018-06-25 15:57:11 UTC (rev 233148)
@@ -1,3 +1,17 @@
+2018-06-25  Simon Fraser  <simon.fra...@apple.com>
+
+        AutoTableLayout wastes 52KB of Vector capacity on nytimes.com
+        https://bugs.webkit.org/show_bug.cgi?id=186710
+
+        Reviewed by Zalan Bujtas.
+        
+        Call resizeToFit() to only allocate enough capacity for the number of columns.
+
+        * rendering/AutoTableLayout.cpp:
+        (WebCore::AutoTableLayout::fullRecalc):
+        (WebCore::AutoTableLayout::insertSpanCell): Whitespace fix.
+        * rendering/AutoTableLayout.h:
+
 2018-06-25  Zalan Bujtas  <za...@apple.com>
 
         [LFC] Adjust static position with containing block's content box top/left

Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (233147 => 233148)


--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp	2018-06-25 15:38:03 UTC (rev 233147)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp	2018-06-25 15:57:11 UTC (rev 233148)
@@ -146,7 +146,7 @@
     m_effectiveLogicalWidthDirty = true;
 
     unsigned nEffCols = m_table->numEffCols();
-    m_layoutStruct.resize(nEffCols);
+    m_layoutStruct.resizeToFit(nEffCols);
     m_layoutStruct.fill(Layout());
     m_spanCells.fill(0);
 
@@ -483,7 +483,7 @@
     if (!size || m_spanCells[size-1] != 0) {
         m_spanCells.grow(size + 10);
         for (unsigned i = 0; i < 10; i++)
-            m_spanCells[size+i] = 0;
+            m_spanCells[size + i] = 0;
         size += 10;
     }
 

Modified: trunk/Source/WebCore/rendering/AutoTableLayout.h (233147 => 233148)


--- trunk/Source/WebCore/rendering/AutoTableLayout.h	2018-06-25 15:38:03 UTC (rev 233147)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.h	2018-06-25 15:57:11 UTC (rev 233148)
@@ -59,8 +59,8 @@
         bool emptyCellsOnly { true };
     };
 
-    Vector<Layout, 4> m_layoutStruct;
-    Vector<RenderTableCell*, 4> m_spanCells;
+    Vector<Layout> m_layoutStruct;
+    Vector<RenderTableCell*> m_spanCells;
     bool m_hasPercent : 1;
     mutable bool m_effectiveLogicalWidthDirty : 1;
     LayoutUnit m_scaledWidthFromPercentColumns;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to