Title: [288614] trunk/Source/WebCore
Revision
288614
Author
[email protected]
Date
2022-01-26 04:56:20 -0800 (Wed, 26 Jan 2022)

Log Message

REGRESSION(r287684) speedtest.net uses many GB of memory
https://bugs.webkit.org/show_bug.cgi?id=235615
rdar://87830583

Reviewed by Youenn Fablet.

The regression was introduced with r286937 and is a good example of
errors introduced when attempting to optimise things too early.
CachedRawResource::updateBuffer does a search in the accumulating
resource's SharedBuffer, search that was taking O(log(n)+1) prior r286937
where n is the number of DataView segments in the SharedBuffer.
This was simplified as a O(1) operation by using the combined contiguous
SharedBuffer instead.
However, that caused every single intermediary accumulated buffers to be
kept referenced by the XMLHttpRequest SharedBufferBuilder leading to
massive memory use.

* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::updateBuffer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288613 => 288614)


--- trunk/Source/WebCore/ChangeLog	2022-01-26 12:18:57 UTC (rev 288613)
+++ trunk/Source/WebCore/ChangeLog	2022-01-26 12:56:20 UTC (rev 288614)
@@ -1,3 +1,25 @@
+2022-01-26  Jean-Yves Avenard  <[email protected]>
+
+        REGRESSION(r287684) speedtest.net uses many GB of memory
+        https://bugs.webkit.org/show_bug.cgi?id=235615
+        rdar://87830583
+
+        Reviewed by Youenn Fablet.
+
+        The regression was introduced with r286937 and is a good example of
+        errors introduced when attempting to optimise things too early.
+        CachedRawResource::updateBuffer does a search in the accumulating
+        resource's SharedBuffer, search that was taking O(log(n)+1) prior r286937
+        where n is the number of DataView segments in the SharedBuffer.
+        This was simplified as a O(1) operation by using the combined contiguous
+        SharedBuffer instead.
+        However, that caused every single intermediary accumulated buffers to be
+        kept referenced by the XMLHttpRequest SharedBufferBuilder leading to
+        massive memory use.
+
+        * loader/cache/CachedRawResource.cpp:
+        (WebCore::CachedRawResource::updateBuffer):
+
 2022-01-26  Antoine Quint  <[email protected]>
 
         [Model] Mouse interaction for <model> is flipped in the y-axis

Modified: trunk/Source/WebCore/loader/cache/CachedRawResource.cpp (288613 => 288614)


--- trunk/Source/WebCore/loader/cache/CachedRawResource.cpp	2022-01-26 12:18:57 UTC (rev 288613)
+++ trunk/Source/WebCore/loader/cache/CachedRawResource.cpp	2022-01-26 12:56:20 UTC (rev 288614)
@@ -67,8 +67,8 @@
     m_data = data.makeContiguous();
 
     auto previousDataSize = encodedSize();
-    while (m_data->size() > previousDataSize) {
-        auto incrementalData = m_data->getSomeData(previousDataSize);
+    while (data.size() > previousDataSize) {
+        auto incrementalData = data.getSomeData(previousDataSize);
         previousDataSize += incrementalData.size();
 
         SetForScope<bool> notifyScope(m_inIncrementalDataNotify, true);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to