Title: [130338] trunk/Source/WebCore
Revision
130338
Author
jsb...@chromium.org
Date
2012-10-03 16:13:56 -0700 (Wed, 03 Oct 2012)

Log Message

IndexedDB: Don't do full commit for empty transactions
https://bugs.webkit.org/show_bug.cgi?id=89239

Reviewed by Tony Chang.

Don't bother creating a leveldb write batch if there's nothing in the transaction
to commit. Note that a read-only transaction may still have index cleanup so may
not be an empty transaction.

This cuts the Lookup2 benchmark in http://reyesr.github.com/html5-storage-benchmark/
from 70s to 2s.

Covered by existing tests, e.g. storage/indexeddb/transaction-basics.html

* platform/leveldb/LevelDBTransaction.cpp:
(WebCore::LevelDBTransaction::commit):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (130337 => 130338)


--- trunk/Source/WebCore/ChangeLog	2012-10-03 22:59:19 UTC (rev 130337)
+++ trunk/Source/WebCore/ChangeLog	2012-10-03 23:13:56 UTC (rev 130338)
@@ -1,3 +1,22 @@
+2012-10-03  Joshua Bell  <jsb...@chromium.org>
+
+        IndexedDB: Don't do full commit for empty transactions
+        https://bugs.webkit.org/show_bug.cgi?id=89239
+
+        Reviewed by Tony Chang.
+
+        Don't bother creating a leveldb write batch if there's nothing in the transaction
+        to commit. Note that a read-only transaction may still have index cleanup so may
+        not be an empty transaction.
+
+        This cuts the Lookup2 benchmark in http://reyesr.github.com/html5-storage-benchmark/
+        from 70s to 2s.
+
+        Covered by existing tests, e.g. storage/indexeddb/transaction-basics.html
+
+        * platform/leveldb/LevelDBTransaction.cpp:
+        (WebCore::LevelDBTransaction::commit):
+
 2012-10-03  Adam Klein  <ad...@chromium.org>
 
         Remove bogus FIXME from Document.idl

Modified: trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp (130337 => 130338)


--- trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp	2012-10-03 22:59:19 UTC (rev 130337)
+++ trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp	2012-10-03 23:13:56 UTC (rev 130338)
@@ -125,6 +125,12 @@
 bool LevelDBTransaction::commit()
 {
     ASSERT(!m_finished);
+
+    if (m_tree.is_empty()) {
+        m_finished = true;
+        return true;
+    }
+
     OwnPtr<LevelDBWriteBatch> writeBatch = LevelDBWriteBatch::create();
 
     TreeType::Iterator iterator;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to