RESOLVED FIXED Bug 225855
Avoid more String creations when preparing SQLite statements
https://bugs.webkit.org/show_bug.cgi?id=225855
Summary Avoid more String creations when preparing SQLite statements
Chris Dumez
Reported 2021-05-16 11:27:23 PDT
Avoid more String creations when preparing SQLite statements by using ASCIILiteral. Also rename the SQLiteDatabase::prepareString(const String&) overload so that it doesn't get called by mistake.
Attachments
Patch (93.88 KB, patch)
2021-05-16 12:12 PDT, Chris Dumez
ews-feeder: commit-queue-
Patch (94.05 KB, patch)
2021-05-16 12:24 PDT, Chris Dumez
ews-feeder: commit-queue-
Patch (95.06 KB, patch)
2021-05-16 12:28 PDT, Chris Dumez
ews-feeder: commit-queue-
Patch (95.06 KB, patch)
2021-05-16 12:33 PDT, Chris Dumez
no flags
Patch (98.28 KB, patch)
2021-05-17 11:17 PDT, Chris Dumez
ews-feeder: commit-queue-
Chris Dumez
Comment 1 2021-05-16 12:12:11 PDT
EWS Watchlist
Comment 2 2021-05-16 12:13:02 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Chris Dumez
Comment 3 2021-05-16 12:24:15 PDT
Chris Dumez
Comment 4 2021-05-16 12:28:23 PDT
Chris Dumez
Comment 5 2021-05-16 12:33:35 PDT
Alex Christensen
Comment 6 2021-05-17 09:30:14 PDT
Comment on attachment 428802 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428802&action=review > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:136 > + return "CREATE TABLE Records (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL, value NOT NULL ON CONFLICT FAIL, recordID INTEGER PRIMARY KEY)"_s; We could use the preprocessor to put the common parts of this in one place. > Source/WebCore/workers/service/server/RegistrationDatabase.cpp:73 > static const String recordsTableSchemaAlternate() It looks like this can be an ASCIILiteral too. > Source/WebCore/workers/service/server/RegistrationDatabase.cpp:76 > + "key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE" ditto on the duplicate code. preprocessor
Sihui Liu
Comment 7 2021-05-17 10:14:42 PDT
Comment on attachment 428802 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428802&action=review > Source/WebKit/ChangeLog:10 > + Avoid more String creations when preparing SQLite statements by using ASCIILiteral. Also rename the > + SQLiteDatabase::prepareStatement() / SQLiteDatabase::executeCommand() overloads that take in a > + String to make sure they are not called by mistake. In Source/WebCore/ChangeLog? > Source/WebKitLegacy/ChangeLog:10 > + Avoid more String creations when preparing SQLite statements by using ASCIILiteral. Also rename the > + SQLiteDatabase::prepareStatement() / SQLiteDatabase::executeCommand() overloads that take in a > + String to make sure they are not called by mistake. Ditto. > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:290 > + if (!database.executeCommandSlow(v3RecordsTableSchema("_Temp_Records"))) { static const String v3RecordsTableSchema(const String& tableName) is only used here with this change. Maybe just change it to static ASCIILiteral v3RecordsTableSchemaTemp()? > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:455 > + if (!m_sqliteDB->executeCommandSlow(v3IndexRecordsTableSchema("_Temp_IndexRecords"))) { Same as above. Make it static ASCIILiteral v3IndexRecordsTableSchemaTemp()? > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:596 > + if (!m_sqliteDB->executeCommandSlow(indexInfoTableSchema("IndexInfo"_s))) { Maybe convert static String indexInfoTableSchema(ASCIILiteral tableName) to static ASCIILiteral indexInfoTableSchema() and static ASCIILiteral indexInfoTableSchemaTemp()? > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:783 > + if (!database.executeCommandSlow(v3IndexRecordsTableSchema("_Temp_IndexRecords"))) { static ASCIILiteral v3IndexRecordsTableSchemaTemp()?
Chris Dumez
Comment 8 2021-05-17 11:17:52 PDT
EWS
Comment 9 2021-05-17 12:26:15 PDT
Committed r277601 (237818@main): <https://commits.webkit.org/237818@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 428848 [details].
Radar WebKit Bug Importer
Comment 10 2021-05-17 12:27:16 PDT
Alex Christensen
Comment 11 2021-05-17 17:10:03 PDT
Fujii Hironori
Comment 12 2021-05-17 19:14:41 PDT
Note You need to log in before you can comment on or make changes to this bug.