D28944: ImapSet: optimize the set before serialization
Daniel Vrátil
noreply at phabricator.kde.org
Sat Apr 18 15:33:31 BST 2020
dvratil created this revision.
Herald added a project: KDE PIM.
Herald added a subscriber: kde-pim.
dvratil requested review of this revision.
REVISION SUMMARY
Client code usually generates the ImapSet by simply passing it a vector of
IDs or just by calling ImapSet::add() in a for loop for individual IDs. This
creates potentially massive amount of intervals. This change ads a method
that will optimize the ImapSet by merging adjacent or overlapping intervals.
I ran into this trying to move about 28'000 emails to Trash in KMail. The IMAP
resource calls ImapSet::add() in a for loop to add each Item to be moved into
the set. This just created 28'000 single-UID intervals and the resulting request
string was so long that my Courier IMAP server just dropped the connection, so
the IMAP resource reconnected and tried to send the same massive request again
and again and again...
By optimizing the set the string size is reduced from nearly 156 kilobytes
down to less than 4 kilobytes.
REPOSITORY
R177 PIM: KIMAP
BRANCH
master
REVISION DETAIL
https://phabricator.kde.org/D28944
AFFECTED FILES
autotests/imapsettest.cpp
src/copyjob.cpp
src/fetchjob.cpp
src/imapset.cpp
src/imapset.h
src/movejob.cpp
src/searchjob.cpp
src/storejob.cpp
To: dvratil
Cc: kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200418/bbcaf73a/attachment.html>
More information about the kde-pim
mailing list