TrailingObjects shouldn't shrink vector capacity in a loop
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jul 2013 17:43:07 +0000 (17:43 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jul 2013 17:43:07 +0000 (17:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=118322

Reviewed by Darin Adler.

This seems to take about 3% off the profile of loading a large text file.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::TrailingObjects::clear): clear() has the built-in side effect
of throwing away existing capacity. Use shrink(0) to indicate that we
want to keep our existing capacity.

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlockLineLayout.cpp

index d10d668..2d786ce 100644 (file)
@@ -1,3 +1,17 @@
+2013-07-19  Geoffrey Garen  <ggaren@apple.com>
+
+        TrailingObjects shouldn't shrink vector capacity in a loop
+        https://bugs.webkit.org/show_bug.cgi?id=118322
+
+        Reviewed by Darin Adler.
+
+        This seems to take about 3% off the profile of loading a large text file.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::TrailingObjects::clear): clear() has the built-in side effect
+        of throwing away existing capacity. Use shrink(0) to indicate that we
+        want to keep our existing capacity.
+
 2013-07-19  Diego Pino Garcia  <dpino@igalia.com>
 
         [GTK] Merge decamelizations fix ups in the GObject DOM bindings code generator
index 67ce6fc..639ba82 100644 (file)
@@ -2743,7 +2743,7 @@ inline void TrailingObjects::setTrailingWhitespace(RenderText* whitespace)
 inline void TrailingObjects::clear()
 {
     m_whitespace = 0;
-    m_boxes.clear();
+    m_boxes.shrink(0); // Use shrink(0) instead of clear() to retain our capacity.
 }
 
 inline void TrailingObjects::appendBoxIfNeeded(RenderBoxModelObject* box)