diff options
-rw-r--r-- | hawd_defs/mail_query_incremental | 8 | ||||
-rw-r--r-- | tests/mailquerybenchmark.cpp | 21 |
2 files changed, 25 insertions, 4 deletions
diff --git a/hawd_defs/mail_query_incremental b/hawd_defs/mail_query_incremental new file mode 100644 index 0000000..c631c90 --- /dev/null +++ b/hawd_defs/mail_query_incremental | |||
@@ -0,0 +1,8 @@ | |||
1 | { | ||
2 | "name": "Compare performance of incremental vs non-incremental", | ||
3 | "description": "Compare performance of incremental vs non-incremental", | ||
4 | "columns": [ | ||
5 | { "name": "nonincremental", "type": "float", "unit": "result/ms" }, | ||
6 | { "name": "incremental", "type": "float", "unit": "result/ms" } | ||
7 | ] | ||
8 | } | ||
diff --git a/tests/mailquerybenchmark.cpp b/tests/mailquerybenchmark.cpp index f6d7130..700eb94 100644 --- a/tests/mailquerybenchmark.cpp +++ b/tests/mailquerybenchmark.cpp | |||
@@ -223,7 +223,8 @@ private slots: | |||
223 | } | 223 | } |
224 | QCOMPARE(added.size(), expectedSize); | 224 | QCOMPARE(added.size(), expectedSize); |
225 | 225 | ||
226 | std::cout << "Initial query took: " << time.elapsed() << std::endl; | 226 | auto initialQueryTime = time.elapsed(); |
227 | std::cout << "Initial query took: " << initialQueryTime << std::endl; | ||
227 | 228 | ||
228 | populateDatabase(count, 10, false, count); | 229 | populateDatabase(count, 10, false, count); |
229 | time.restart(); | 230 | time.restart(); |
@@ -232,13 +233,25 @@ private slots: | |||
232 | context.mResourceAccess->revisionChanged(1000 + i * 100); | 233 | context.mResourceAccess->revisionChanged(1000 + i * 100); |
233 | } | 234 | } |
234 | //We should have 200 items in total in the end. 2000 mails / 10 folders => 200 reduced mails | 235 | //We should have 200 items in total in the end. 2000 mails / 10 folders => 200 reduced mails |
235 | QTRY_COMPARE(added.count(), 200); | 236 | while (added.count() != 200) { |
237 | QTest::qWait(1); | ||
238 | } | ||
236 | //We get one modification per thread from the first 100 (1000 mails / 10 folders), everything else is optimized away because we ignore repeated updates to the same thread. | 239 | //We get one modification per thread from the first 100 (1000 mails / 10 folders), everything else is optimized away because we ignore repeated updates to the same thread. |
237 | QTRY_COMPARE(modified.count(), 100); | 240 | while (modified.count() != 100) { |
238 | std::cout << "Incremental query took " << time.elapsed() << std::endl; | 241 | QTest::qWait(1); |
242 | } | ||
243 | auto incrementalQueryTime = time.elapsed(); | ||
244 | std::cout << "Incremental query took " << incrementalQueryTime << std::endl; | ||
239 | std::cout << "added " << added.count() << std::endl; | 245 | std::cout << "added " << added.count() << std::endl; |
240 | std::cout << "modified " << modified.count() << std::endl; | 246 | std::cout << "modified " << modified.count() << std::endl; |
241 | std::cout << "removed " << removed.count() << std::endl; | 247 | std::cout << "removed " << removed.count() << std::endl; |
248 | |||
249 | HAWD::Dataset dataset("mail_query_incremental", mHawdState); | ||
250 | HAWD::Dataset::Row row = dataset.row(); | ||
251 | row.setValue("nonincremental", initialQueryTime); | ||
252 | row.setValue("incremental", incrementalQueryTime); | ||
253 | dataset.insertRow(row); | ||
254 | HAWD::Formatter::print(dataset); | ||
242 | } | 255 | } |
243 | }; | 256 | }; |
244 | 257 | ||