aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-05-13 16:00:26 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-05-13 16:00:26 +0900
commitc25de4e19801c7931ce857c29a7a48be7f5c4dbe (patch)
tree53722a470324946d5b3662e66cf517adf23ebe14 /jobs
parent63db311d5a64b9942dc69e1b13b4570a548554c0 (diff)
downloadlibquotient-c25de4e19801c7931ce857c29a7a48be7f5c4dbe.tar.gz
libquotient-c25de4e19801c7931ce857c29a7a48be7f5c4dbe.zip
More code cleanup and tweaks; fine-tuning logs; performance improvements
After adding some profiling it became clear that to recalculate the room name and emit namesChanged() upon each member event is a waste, especially when there are thousands of those coming at initial sync (*cough* Matrix HQ room). So the room name is recalculated only once and unconditionally (in most cases this will boil down to checking whether name/canonicalAlias changed after processing the events batch), and namesChanged is only emitted once per batch, if any name or alias changed.
Diffstat (limited to 'jobs')
-rw-r--r--jobs/syncjob.cpp4
-rw-r--r--jobs/syncjob.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/jobs/syncjob.cpp b/jobs/syncjob.cpp
index fb6bb9b9..5984128f 100644
--- a/jobs/syncjob.cpp
+++ b/jobs/syncjob.cpp
@@ -63,9 +63,9 @@ QString SyncJob::nextBatch() const
return d->nextBatch;
}
-SyncData& SyncJob::roomData()
+SyncData&& SyncJob::takeRoomData()
{
- return d->roomData;
+ return std::move(d->roomData);
}
BaseJob::Status SyncJob::parseJson(const QJsonDocument& data)
diff --git a/jobs/syncjob.h b/jobs/syncjob.h
index 21d3cfca..48be9423 100644
--- a/jobs/syncjob.h
+++ b/jobs/syncjob.h
@@ -70,7 +70,7 @@ namespace QMatrixClient
int timeout = -1, const QString& presence = {});
virtual ~SyncJob();
- SyncData& roomData();
+ SyncData&& takeRoomData();
QString nextBatch() const;
protected: