Changeset 209157 in webkit


Ignore:
Timestamp:
Nov 30, 2016 2:59:28 PM (7 years ago)
Author:
beidson@apple.com
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209156 r209157  
     12016-11-30  Brady Eidson  <beidson@apple.com>
     2
     3        IndexedDB 2.0: Send operations off to the server in batches instead of one at a time.
     4        https://bugs.webkit.org/show_bug.cgi?id=165221
     5
     6        Reviewed by Myles C. Maxfield.
     7
     8        No new tests (No observable behavior change).
     9
     10        On a profile of "Lots of writes to an IndexedDB", timer scheduling/firing presented as over 10% of the time.
     11
     12        This patch negates much of that.
     13
     14        * Modules/indexeddb/IDBTransaction.cpp:
     15        (WebCore::IDBTransaction::pendingOperationTimerFired): Send 100 operations off to the server
     16          before spinning the runloop, instead of only 1.
     17
    1182016-11-30  Antoine Quint  <graouts@apple.com>
    219
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

    r209132 r209157  
    407407        return;
    408408
    409     if (!m_pendingTransactionOperationQueue.isEmpty()) {
     409    // We want to batch operations together without spinning the runloop for performance,
     410    // but don't want to affect responsiveness of the main thread.
     411    // This number is a good compromise in ad-hoc testing.
     412    static const size_t operationBatchLimit = 128;
     413
     414    for (size_t iterations = 0; !m_pendingTransactionOperationQueue.isEmpty() && iterations < operationBatchLimit; ++iterations) {
    410415        auto operation = m_pendingTransactionOperationQueue.takeFirst();
    411416        m_transactionOperationsInProgressQueue.append(operation.get());
    412417        operation->perform();
    413418
    414         // If this operation we just started has an associated IDBRequest, we might be able to send
    415         // another operation to the server before it completes.
    416         if (operation->idbRequest() && !m_pendingTransactionOperationQueue.isEmpty())
    417             schedulePendingOperationTimer();
    418 
    419         return;
     419        if (!operation->nextRequestCanGoToServer())
     420            break;
     421
    420422    }
    421423
Note: See TracChangeset for help on using the changeset viewer.