As I recently changed my imap downloading tool choice from offlineimap to mbsync, and because the word on the street (where with “street” I mean “random discussion forums on the internet”) is that mbsync is generally faster than offlineimap, I wanted to run a small test to measure the difference.

Methods

For this test, I re-synchronized the exact same subset of my IMAP folders, totalling about 11000 emails, which together occupy about 2GB on disc.

The idea here was to measure which of the two tools was fastest for my use case, which is re-synchronizing multiple times per day from within the mu4e Emacs mail client.

I ran the test in WSL on Windows 10 version 1903, on the WSL lxfs filesystem. Windows 10 antivirus real-time protection was disabled to eliminate any effect it might have on performance.

Each test was executed five times using the unix time tool, and the measurements were averaged.

Software versions used

For this test I used isync version 1.4.0, and OfflineIMAP 7.2.4.

The details of the OfflineIMAP installation were as follows:

1
2
3
OfflineIMAP 7.2.4
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.57 (bundled), Python v2.7.15+, OpenSSL 1.1.1  11 Sep 2018

Results

tool avg over 5 runs (s) std-dev
mbsync 7.377 0.550
offlineimap 11.238 0.926
offlineimap quick 6.159 0.159

Discussion

In their default full synchronization modes, mbsync is indeed substantially faster than offlineimap.

However, when offlineimap uses its quick folder change mode, and the folder(s) have not changed (something which can happen quite often during the day), offlineimap is slightly faster than mbsync in full synchronization mode.

The implementation of OfflineIMAP’s quick folder change check looks as follows:

In short, for a remote folder it checks if the number of emails have changed (I’m not 100% sure what that max(msgid) instead of just a len is for, so it’s possible that the heuristic is doing a little more work), and for a local filter it compares the actual UIDs and flags, and skips syncing the folder completely if these heuristics come up negatitve.

This could mean that you miss flag changes on the server, which might be a trade-off you’re willing to take.

To summarise: mbsync is faster than offlineimap for full synchronisation runs. However, offlineimap is slightly faster when no changes have occurred and it’s able to skip the sync.

Which of the tools works faster for your workflow will depend on the exact setup of your imap folders and maildirs, and how often these folders mutate during the day relative to the number of times that you sync.