Optimize RoomList sorting

Keep the almost sorted list around and sort by the raw timestamp value
instead of doing the expensive toMSecSinceEpoch conversion.
This commit is contained in:
Nicolas Werner 2020-04-30 23:59:17 +02:00
parent e6fcccc8bd
commit 641a883bfd
5 changed files with 41 additions and 35 deletions

View file

@ -41,6 +41,7 @@ createDescriptionInfo(const Event &event, const QString &localUser, const QStrin
utils::messageDescription<T>(
username, QString::fromStdString(msg.content.body).trimmed(), sender == localUser),
utils::descriptiveTime(ts),
msg.origin_server_ts,
ts};
}
@ -184,9 +185,10 @@ utils::getMessageDescription(const TimelineEvent &event,
info.userid = sender;
info.body = QString(" %1").arg(
messageDescription<Encrypted>(username, "", sender == localUser));
info.timestamp = utils::descriptiveTime(ts);
info.event_id = QString::fromStdString(msg->event_id);
info.datetime = ts;
info.timestamp = msg->origin_server_ts;
info.descriptiveTime = utils::descriptiveTime(ts);
info.event_id = QString::fromStdString(msg->event_id);
info.datetime = ts;
return info;
}