summaryrefslogtreecommitdiffstats
path: root/tests/storagebenchmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/storagebenchmark.cpp')
-rw-r--r--tests/storagebenchmark.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp
index ce1005d..f143c4d 100644
--- a/tests/storagebenchmark.cpp
+++ b/tests/storagebenchmark.cpp
@@ -97,9 +97,12 @@ private Q_SLOTS:
97 auto event = createEvent(); 97 auto event = createEvent();
98 if (store) { 98 if (store) {
99 auto transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); 99 auto transaction = store->createTransaction(Akonadi2::Storage::ReadWrite);
100 transaction.setAutocommit(10000);
101 for (int i = 0; i < count; i++) { 100 for (int i = 0; i < count; i++) {
102 transaction.write(keyPrefix + QByteArray::number(i), event); 101 transaction.write(keyPrefix + QByteArray::number(i), event);
102 if ((i % 10000) == 0) {
103 transaction.commit();
104 transaction = store->createTransaction(Akonadi2::Storage::ReadWrite);
105 }
103 } 106 }
104 transaction.commit(); 107 transaction.commit();
105 } else { 108 } else {
@@ -116,8 +119,9 @@ private Q_SLOTS:
116 { 119 {
117 if (store) { 120 if (store) {
118 auto transaction = store->createTransaction(Akonadi2::Storage::ReadOnly); 121 auto transaction = store->createTransaction(Akonadi2::Storage::ReadOnly);
122 auto db = transaction.openDatabase();
119 for (int i = 0; i < count; i++) { 123 for (int i = 0; i < count; i++) {
120 transaction.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); 124 db.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; });
121 } 125 }
122 } 126 }
123 } 127 }