Title: [185381] trunk/Source/_javascript_Core
Revision
185381
Author
[email protected]
Date
2015-06-09 14:23:03 -0700 (Tue, 09 Jun 2015)

Log Message

[JSC] Polymorphic{Get,Put}ByIdList::addAccess() should optimize for size, not speed.
<https://webkit.org/b/145786>

Reviewed by Darin Adler.

These functions already contained comments saying they optimize for size over speed,
but they were using Vector::resize() which adds the usual slack for faster append().

Switch them over to using Vector::resizeToFit() instead, which makes the Vector
allocate a perfectly sized backing store.

Spotted 670 kB of the GetById ones, and 165 kB of PutById on cnet.com, so these
Vectors are definitely worth shrink-wrapping.

* bytecode/PolymorphicGetByIdList.cpp:
(JSC::PolymorphicGetByIdList::addAccess):
* bytecode/PolymorphicPutByIdList.cpp:
(JSC::PolymorphicPutByIdList::addAccess):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (185380 => 185381)


--- trunk/Source/_javascript_Core/ChangeLog	2015-06-09 21:21:16 UTC (rev 185380)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-06-09 21:23:03 UTC (rev 185381)
@@ -1,5 +1,26 @@
 2015-06-09  Andreas Kling  <[email protected]>
 
+        [JSC] Polymorphic{Get,Put}ByIdList::addAccess() should optimize for size, not speed.
+        <https://webkit.org/b/145786>
+
+        Reviewed by Darin Adler.
+
+        These functions already contained comments saying they optimize for size over speed,
+        but they were using Vector::resize() which adds the usual slack for faster append().
+
+        Switch them over to using Vector::resizeToFit() instead, which makes the Vector
+        allocate a perfectly sized backing store.
+
+        Spotted 670 kB of the GetById ones, and 165 kB of PutById on cnet.com, so these
+        Vectors are definitely worth shrink-wrapping.
+
+        * bytecode/PolymorphicGetByIdList.cpp:
+        (JSC::PolymorphicGetByIdList::addAccess):
+        * bytecode/PolymorphicPutByIdList.cpp:
+        (JSC::PolymorphicPutByIdList::addAccess):
+
+2015-06-09  Andreas Kling  <[email protected]>
+
         [JSC] JSPropertyNameEnumerator's property name vector should be sized-to-fit.
         <https://webkit.org/b/145787>
 

Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.cpp (185380 => 185381)


--- trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.cpp	2015-06-09 21:21:16 UTC (rev 185380)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.cpp	2015-06-09 21:23:03 UTC (rev 185381)
@@ -116,7 +116,7 @@
 {
     ASSERT(!isFull());
     // Make sure that the resizing optimizes for space, not time.
-    m_list.resize(m_list.size() + 1);
+    m_list.resizeToFit(m_list.size() + 1);
     m_list.last() = access;
 }
 

Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.cpp (185380 => 185381)


--- trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.cpp	2015-06-09 21:21:16 UTC (rev 185380)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.cpp	2015-06-09 21:23:03 UTC (rev 185381)
@@ -138,7 +138,7 @@
 {
     ASSERT(!isFull());
     // Make sure that the resizing optimizes for space, not time.
-    m_list.resize(m_list.size() + 1);
+    m_list.resizeToFit(m_list.size() + 1);
     m_list.last() = putByIdAccess;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to