summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilian Wolff <[email protected]>2017-09-22 21:14:52 +0200
committerMilian Wolff <[email protected]>2017-09-25 14:49:55 +0200
commit8616ee44da5e344263e0328eae0e200681e4ba68 (patch)
tree7418b499f362a2f4fcc2841904eb18800d6b7a6d
parente7c557a1be8d22e3155f0e3b03b1d1f5ba969dda (diff)
Reuse the same data when inReplyTo and References are equal
This is only sharing the data within a single mail. It could be optimized even further by reusing the same instance for every thread. But I think that's not easy without implementing threading on the server side. This decreases peak memory consumption by ~100MB on my mails, when opening the LKML folder. Depends on new KMime API (cf. https://phabricator.kde.org/D7920). Reviewed By: vkrause Differential Revision: https://phabricator.kde.org/D7921
-rw-r--r--CMakeLists.txt2
-rw-r--r--plugins/akonadi_serializer_mail.cpp12
2 files changed, 10 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b30374..4c37aa2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,7 +79,7 @@ set(KMBOX_LIB_VERSION "5.6.40")
set(AKONADICALENDAR_LIB_VERSION "5.6.40")
set(KONTACTINTERFACE_LIB_VERSION "5.6.40")
set(AKONADIKALARM_LIB_VERSION "5.6.40")
-set(KMIME_LIB_VERSION "5.6.40")
+set(KMIME_LIB_VERSION "5.6.42")
set(XMLRPCCLIENT_LIB_VERSION "5.6.40")
set(KCONTACTS_LIB_VERSION "5.6.40")
set(AKONADIMIME_LIB_VERSION "5.6.40")
diff --git a/plugins/akonadi_serializer_mail.cpp b/plugins/akonadi_serializer_mail.cpp
index 12595f7..6d50de2 100644
--- a/plugins/akonadi_serializer_mail.cpp
+++ b/plugins/akonadi_serializer_mail.cpp
@@ -191,12 +191,18 @@ bool SerializerPluginMail::deserialize(Item &item, const QByteArray &label, QIOD
msg->date()->setDateTime(dt);
stream >> str;
msg->subject()->fromUnicodeString(str, QByteArrayLiteral("UTF-8"));
- stream >> str;
- msg->inReplyTo()->fromUnicodeString(str, QByteArrayLiteral("UTF-8"));
+
+ QString inReplyTo;
+ stream >> inReplyTo;
+ msg->inReplyTo()->fromUnicodeString(inReplyTo, QByteArrayLiteral("UTF-8"));
stream >> str;
msg->messageID()->fromUnicodeString(str, QByteArrayLiteral("UTF-8"));
stream >> str;
- msg->references()->fromUnicodeString(str, QByteArrayLiteral("UTF-8"));
+ if (str == inReplyTo) {
+ msg->references()->fromIdent(msg->inReplyTo());
+ } else {
+ msg->references()->fromUnicodeString(str, QByteArrayLiteral("UTF-8"));
+ }
parseAddrList(stream, msg->from(), version, m_stringPool);
parseAddrList(stream, msg->sender(), version, m_stringPool);