Title: [289078] trunk/Source/WebCore
Revision
289078
Author
[email protected]
Date
2022-02-03 14:12:39 -0800 (Thu, 03 Feb 2022)

Log Message

LocalStorage values should be 8-bit strings in memory if possible
https://bugs.webkit.org/show_bug.cgi?id=235484

Reviewed by Chris Dumez.

LocalStorage values are stored into a SQLite column as 16-bit strings and are deserialized
back into memory as 16-bit strings. To save memory, this makes it so that we deserialize the
string into an 8-bit string in memory if possible.

Estimated win of ~3MB on Membuster5.

* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::columnBlobAsString):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289077 => 289078)


--- trunk/Source/WebCore/ChangeLog	2022-02-03 21:47:06 UTC (rev 289077)
+++ trunk/Source/WebCore/ChangeLog	2022-02-03 22:12:39 UTC (rev 289078)
@@ -1,3 +1,19 @@
+2022-02-03  Ben Nham  <[email protected]>
+
+        LocalStorage values should be 8-bit strings in memory if possible
+        https://bugs.webkit.org/show_bug.cgi?id=235484
+
+        Reviewed by Chris Dumez.
+
+        LocalStorage values are stored into a SQLite column as 16-bit strings and are deserialized
+        back into memory as 16-bit strings. To save memory, this makes it so that we deserialize the
+        string into an 8-bit string in memory if possible.
+
+        Estimated win of ~3MB on Membuster5.
+
+        * platform/sql/SQLiteStatement.cpp:
+        (WebCore::SQLiteStatement::columnBlobAsString):
+
 2022-02-03  Ziran Sun  <[email protected]>
 
         [Forms] Value doesn't change for stepUp()/stepDown() with out of range values

Modified: trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp (289077 => 289078)


--- trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp	2022-02-03 21:47:06 UTC (rev 289077)
+++ trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp	2022-02-03 22:12:39 UTC (rev 289078)
@@ -284,7 +284,7 @@
         return String();
 
     ASSERT(!(size % sizeof(UChar)));
-    return String(static_cast<const UChar*>(blob), size / sizeof(UChar));
+    return StringImpl::create8BitIfPossible(static_cast<const UChar*>(blob), size / sizeof(UChar));
 }
 
 Vector<uint8_t> SQLiteStatement::columnBlob(int col)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to