summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-08 22:10:04 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-08 22:10:04 +0200
commit393846f660802d53d6ff6744cea0c1fa05019ba3 (patch)
tree2c8906240167af00838314d0b35907c87e4d40d5 /tests
parent624fb3718b5063f29644b69a8082ef9f84a55ec5 (diff)
downloadsink-393846f660802d53d6ff6744cea0c1fa05019ba3.tar.gz
sink-393846f660802d53d6ff6744cea0c1fa05019ba3.zip
Optimized the incremental update case.
This brings the incremental closer to a regular query (about 1.5 times as bad instead of 3.5 times). For a comparison look at MailQueryBenchmark::testIncremental() The optimization is built on the assumption that we i.e. get an update with 100 revisions, and thus the optimization applies to the case where we have multiple revisions within that batch that are part of the same reduction. In such a case we can avoid redoing the reduction lookup over and over.
Diffstat (limited to 'tests')
-rw-r--r--tests/mailquerybenchmark.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/mailquerybenchmark.cpp b/tests/mailquerybenchmark.cpp
index ca1e026..402f31f 100644
--- a/tests/mailquerybenchmark.cpp
+++ b/tests/mailquerybenchmark.cpp
@@ -219,11 +219,14 @@ private slots:
219 219
220 populateDatabase(count, 10, false, count); 220 populateDatabase(count, 10, false, count);
221 time.restart(); 221 time.restart();
222 context.mResourceAccess->revisionChanged(2000); 222 for (int i = 0; i <= 10; i++) {
223 //Simulate revision updates in steps of 100
224 context.mResourceAccess->revisionChanged(1000 + i * 100);
225 }
223 //We should have 200 items in total in the end. 2000 mails / 10 folders => 200 reduced mails 226 //We should have 200 items in total in the end. 2000 mails / 10 folders => 200 reduced mails
224 QTRY_COMPARE(added.count(), 200); 227 QTRY_COMPARE(added.count(), 200);
225 //For every email we have to redo the reduction and increase the count, which is a modification. 228 //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.
226 QTRY_COMPARE(modified.count(), 900); 229 QTRY_COMPARE(modified.count(), 100);
227 std::cout << "Incremental query took " << time.elapsed() << std::endl; 230 std::cout << "Incremental query took " << time.elapsed() << std::endl;
228 std::cout << "added " << added.count() << std::endl; 231 std::cout << "added " << added.count() << std::endl;
229 std::cout << "modified " << modified.count() << std::endl; 232 std::cout << "modified " << modified.count() << std::endl;