Title: [256223] trunk/Source/WebCore
Revision
256223
Author
[email protected]
Date
2020-02-10 15:17:18 -0800 (Mon, 10 Feb 2020)

Log Message

[WebCore] Shrink Vectors passed to SharedBuffer
https://bugs.webkit.org/show_bug.cgi?id=207503

Reviewed by Yusuke Suzuki.

Once SharedBuffer::DataSegment is created, the content won't change in its life cycle. Shrink the passed vector
before assigning to member variable to save space.

With the quick research, when displaying Apple's website, 1~3% RSS usage reduction on PlayStation port.

No new tests because there's no behavior change.

* platform/SharedBuffer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (256222 => 256223)


--- trunk/Source/WebCore/ChangeLog	2020-02-10 23:14:39 UTC (rev 256222)
+++ trunk/Source/WebCore/ChangeLog	2020-02-10 23:17:18 UTC (rev 256223)
@@ -1,3 +1,19 @@
+2020-02-10  Basuke Suzuki  <[email protected]>
+
+        [WebCore] Shrink Vectors passed to SharedBuffer
+        https://bugs.webkit.org/show_bug.cgi?id=207503
+
+        Reviewed by Yusuke Suzuki.
+
+        Once SharedBuffer::DataSegment is created, the content won't change in its life cycle. Shrink the passed vector
+        before assigning to member variable to save space.
+
+        With the quick research, when displaying Apple's website, 1~3% RSS usage reduction on PlayStation port.
+
+        No new tests because there's no behavior change.
+
+        * platform/SharedBuffer.h:
+
 2020-02-10  Timothy Hatcher  <[email protected]>
 
         REGRESSION (r246055): Data detected URLs are no longer blue

Modified: trunk/Source/WebCore/platform/SharedBuffer.h (256222 => 256223)


--- trunk/Source/WebCore/platform/SharedBuffer.h	2020-02-10 23:14:39 UTC (rev 256222)
+++ trunk/Source/WebCore/platform/SharedBuffer.h	2020-02-10 23:17:18 UTC (rev 256223)
@@ -129,7 +129,12 @@
         WEBCORE_EXPORT const char* data() const;
         WEBCORE_EXPORT size_t size() const;
 
-        static Ref<DataSegment> create(Vector<char>&& data) { return adoptRef(*new DataSegment(WTFMove(data))); }
+        static Ref<DataSegment> create(Vector<char>&& data)
+        {
+            data.shrinkToFit();
+            return adoptRef(*new DataSegment(WTFMove(data)));
+        }
+
 #if USE(CF)
         static Ref<DataSegment> create(RetainPtr<CFDataRef>&& data) { return adoptRef(*new DataSegment(WTFMove(data))); }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to