Title: [209157] trunk/Source/WebCore
- Revision
- 209157
- Author
- [email protected]
- Date
- 2016-11-30 14:59:28 -0800 (Wed, 30 Nov 2016)
Log Message
IndexedDB 2.0: Send operations off to the server in batches instead of one at a time.
https://bugs.webkit.org/show_bug.cgi?id=165221
Reviewed by Myles C. Maxfield.
No new tests (No observable behavior change).
On a profile of "Lots of writes to an IndexedDB", timer scheduling/firing presented as over 10% of the time.
This patch negates much of that.
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::pendingOperationTimerFired): Send 100 operations off to the server
before spinning the runloop, instead of only 1.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (209156 => 209157)
--- trunk/Source/WebCore/ChangeLog 2016-11-30 22:45:38 UTC (rev 209156)
+++ trunk/Source/WebCore/ChangeLog 2016-11-30 22:59:28 UTC (rev 209157)
@@ -1,3 +1,20 @@
+2016-11-30 Brady Eidson <[email protected]>
+
+ IndexedDB 2.0: Send operations off to the server in batches instead of one at a time.
+ https://bugs.webkit.org/show_bug.cgi?id=165221
+
+ Reviewed by Myles C. Maxfield.
+
+ No new tests (No observable behavior change).
+
+ On a profile of "Lots of writes to an IndexedDB", timer scheduling/firing presented as over 10% of the time.
+
+ This patch negates much of that.
+
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::pendingOperationTimerFired): Send 100 operations off to the server
+ before spinning the runloop, instead of only 1.
+
2016-11-30 Antoine Quint <[email protected]>
[Modern Media Controls] Controls are not visible when returning from picture-in-picture playback
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (209156 => 209157)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2016-11-30 22:45:38 UTC (rev 209156)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2016-11-30 22:59:28 UTC (rev 209157)
@@ -406,17 +406,19 @@
if (!m_transactionOperationsInProgressQueue.isEmpty() && !m_transactionOperationsInProgressQueue.last()->nextRequestCanGoToServer())
return;
- if (!m_pendingTransactionOperationQueue.isEmpty()) {
+ // We want to batch operations together without spinning the runloop for performance,
+ // but don't want to affect responsiveness of the main thread.
+ // This number is a good compromise in ad-hoc testing.
+ static const size_t operationBatchLimit = 128;
+
+ for (size_t iterations = 0; !m_pendingTransactionOperationQueue.isEmpty() && iterations < operationBatchLimit; ++iterations) {
auto operation = m_pendingTransactionOperationQueue.takeFirst();
m_transactionOperationsInProgressQueue.append(operation.get());
operation->perform();
- // If this operation we just started has an associated IDBRequest, we might be able to send
- // another operation to the server before it completes.
- if (operation->idbRequest() && !m_pendingTransactionOperationQueue.isEmpty())
- schedulePendingOperationTimer();
+ if (!operation->nextRequestCanGoToServer())
+ break;
- return;
}
if (!m_transactionOperationMap.isEmpty() || !m_openRequests.isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes