Title: [129911] trunk/Source/WebCore
Revision
129911
Author
[email protected]
Date
2012-09-28 09:38:54 -0700 (Fri, 28 Sep 2012)

Log Message

IndexedDB: Run multiple tasks per transaction tick
https://bugs.webkit.org/show_bug.cgi?id=97738

Reviewed by Tony Chang.

Process multiple tasks from the pending queue(s) when the timer fires. The
task may initiate new tasks that change which queue is active (e.g. indexing
operations) so the loop must re-check each tick which queue to use.

In DumpRenderTree, time to make 20k puts/20k gets dropped from 3.2s to 2.0s (-37%);
in Chromium's content_shell, the time dropped from 8.1s to 4.6s (-42%).

No new tests - just perf improvements, covered by (nearly) all existing IDB tests.

* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::abort): Use takeFirst() to clean up code.
(WebCore::IDBTransactionBackendImpl::taskTimerFired): Process as many tasks as are available.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129910 => 129911)


--- trunk/Source/WebCore/ChangeLog	2012-09-28 16:38:08 UTC (rev 129910)
+++ trunk/Source/WebCore/ChangeLog	2012-09-28 16:38:54 UTC (rev 129911)
@@ -1,3 +1,23 @@
+2012-09-28  Joshua Bell  <[email protected]>
+
+        IndexedDB: Run multiple tasks per transaction tick
+        https://bugs.webkit.org/show_bug.cgi?id=97738
+
+        Reviewed by Tony Chang.
+
+        Process multiple tasks from the pending queue(s) when the timer fires. The
+        task may initiate new tasks that change which queue is active (e.g. indexing
+        operations) so the loop must re-check each tick which queue to use.
+
+        In DumpRenderTree, time to make 20k puts/20k gets dropped from 3.2s to 2.0s (-37%);
+        in Chromium's content_shell, the time dropped from 8.1s to 4.6s (-42%).
+
+        No new tests - just perf improvements, covered by (nearly) all existing IDB tests.
+
+        * Modules/indexeddb/IDBTransactionBackendImpl.cpp:
+        (WebCore::IDBTransactionBackendImpl::abort): Use takeFirst() to clean up code.
+        (WebCore::IDBTransactionBackendImpl::taskTimerFired): Process as many tasks as are available.
+
 2012-09-28  Harald Tveit Alvestrand  <[email protected]>
         
         Implement the GetStats interface on PeerConnection

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp (129910 => 129911)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp	2012-09-28 16:38:08 UTC (rev 129910)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp	2012-09-28 16:38:54 UTC (rev 129911)
@@ -131,8 +131,7 @@
 
     // Run the abort tasks, if any.
     while (!m_abortTaskQueue.isEmpty()) {
-        OwnPtr<ScriptExecutionContext::Task> task(m_abortTaskQueue.first().release());
-        m_abortTaskQueue.removeFirst();
+        OwnPtr<ScriptExecutionContext::Task> task(m_abortTaskQueue.takeFirst());
         task->performTask(0);
     }
 
@@ -255,15 +254,15 @@
         m_state = Running;
     }
 
-    // Just process a single event here, in case the event itself
-    // changes which queue should be processed next.
-    TaskQueue& taskQueue = m_pendingPreemptiveEvents ? m_preemptiveTaskQueue : m_taskQueue;
-    if (!taskQueue.isEmpty() && m_state != Finished) {
+    TaskQueue* taskQueue = m_pendingPreemptiveEvents ? &m_preemptiveTaskQueue : &m_taskQueue;
+    while (!taskQueue->isEmpty() && m_state != Finished) {
         ASSERT(m_state == Running);
-        OwnPtr<ScriptExecutionContext::Task> task(taskQueue.first().release());
-        taskQueue.removeFirst();
+        OwnPtr<ScriptExecutionContext::Task> task(taskQueue->takeFirst());
         m_pendingEvents++;
         task->performTask(0);
+
+        // Event itself may change which queue should be processed next.
+        taskQueue = m_pendingPreemptiveEvents ? &m_preemptiveTaskQueue : &m_taskQueue;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to