Daniel Colascione 31835200bd New incremental cleanup strategy: 63%-88% faster
This change adds a new cleanup mode that avoids cleanup having
re-traverse the directories the index pass just looked at.
Additionally, we efficiently query the Xapian database by walking the
term list instead of doing multiple point-wise path lookups.

I'd noticed that most of my time in mu's cleanup pass consisted of
B-tree lookups in Xapian (one 8KB pread64 at a time).  The point
lookups forced Xapian to traverse from the root of the B-tree to the
leaf for every single message.  Additionally, in order to join on the
message path, we had to do *another* B-tree traversal after locating
each message term.  Now we just walk the terms in order, which is much
more efficient, as we touch each B-tree node only once.

On my system, with 1371861 total messages, the total time of mu
index (no lazy check):

--nocleanup: 3.6s
incremental cleanup: 4.2s (0.6s in cleanup)
legacy cleanup: 5.2s (1.6s in cleanup)

With the new mode, we save 1.0s of the 1.6s cleanup, so we're
~63% faster.

But the incremental cleanup works even better with lazy checking.
If I enable --lazy-check, dirty only my INBOX (360778 messages), and
run index, I get:

--nocleanup: 0.9s
incremental cleanup: 1.1s (0.2s in cleanup)
legacy cleanup: 2.5s (1.6s in cleanup)

We save 1.4s out of 1.6s for ~88% speedup.

This change also fixes a timestamp bug: we should be storing
the *start* time of the index pass in metadata, not the end time, so
that on the next index pass, we notice messages that arrived between
the two times.

All tests pass.  You can set the environment variable
MU_NO_INCREMENTAL_CLEANUP to use the legacy cleanup path instead.
2026-08-20 15:05:28 -07:00
2026-08-20 15:05:28 -07:00
2026-08-20 15:04:26 -07:00
2022-08-20 11:19:29 +03:00
2026-08-20 15:04:27 -07:00
2026-08-20 15:05:28 -07:00
2026-08-20 15:04:27 -07:00
2023-10-14 16:25:58 +03:00
2023-10-14 16:46:05 +03:00
2025-08-26 14:26:43 -07:00
2025-08-26 14:26:43 -07:00
2026-08-20 15:05:28 -07:00
2026-08-20 15:05:28 -07:00

#+TITLE:mu https://img.shields.io/github/license/djcb/mu?logo=gnu&.svg https://img.shields.io/badge/Made%20with-C/CPP-1f425f?logo=c&.svg https://img.shields.io/github/v/release/djcb/mu.svg https://img.shields.io/github/contributors/djcb/mu.svg https://img.shields.io/github/issues/djcb/mu.svg https://img.shields.io/github/issues/djcb/mu/rfe?color=008b8b.svg https://img.shields.io/badge/PRs-welcome-brightgreen.svg
https://img.shields.io/badge/Emacs-26.3-922793?logo=gnu-emacs&logoColor=b39ddb&.svg https://img.shields.io/badge/Platform-Linux-2e8b57?logo=linux&.svg https://img.shields.io/badge/Platform-FreeBSD-8b3a3a?logo=freebsd&logoColor=c32136&.svg https://img.shields.io/badge/Platform-macOS-101010?logo=apple&logoColor=ffffff&.svg

Welcome to mu!

Latest development news: NEWS.org.

With the enormous amounts of e-mail many people gather and the importance of e-mail message in our work-flows, it's essential to quickly deal with all that mail - in particular, to instantly find that one important e-mail you need right now, and quickly file away message for later use.

mu is a set of command-line tools for dealing with e-mail messages stored in the Maildir-format. mu's goal is to help you to quickly find the messages you need, view them, extract attachments, create new maildirs, and so on.

After indexing your messages into a Xapian-database, you can search them through a query language. You can use various message fields or words in the body text to find the right messages.

Built on top of mu are some extensions (included in this package):

  • mu4e: a full-featured e-mail client that runs inside emacs
  • mu-scm: bindings for the Guile/Scheme programming language (version 3.0 and later)

mu is written in C++; mu4e is written in elisp and mu-scm is written in a mix of C++ and Scheme.

mu is available in many Linux distributions (e.g. Debian/Ubuntu and Fedora) under the name maildir-utils; apparently because they don't like short names. All of the code is distributed under the terms of the GNU General Public License version 3 (or higher).

Versions

mu attempts to balance development speed and stability.

Active development takes place on master (the 1.14 series), and we maintain release/1.12 as well. When possible, fixes (but not features) from master are back-ported to release/1.12.

Every few months, we release a stable version (e.g. 1.14.0); development then continues in master, with -pre<n> (e.g. 1.14.1-pre1): -pre-suffixed versions refer to the current development code, until it is released (and then looses its -pre suffix, i.e., becomes the 1.14.1 release).

Hence, if you want to track active development, use master; if you want to avoid any changes except bug-fixes, use a 1.12 release; otherwise, track master.

Overall, we try to avoid incompatible changes, but sometimes this is necessary, for example to update the versions of required libraries

Installation

Note: building from source is an advanced subject, especially if something goes wrong. The below simple examples are a start, but all tools involved have many options; there are differences between systems, versions etc. So if this is all a bit daunting we recommend to wait for someone else to build it for you, such as a Linux distribution. Many have packages available.

Requirements

To be able to build mu, ensure you have:

  • a C++20 compiler (gcc and clang are known to work)
  • development packages for Xapian and GMime and GLib (see meson.build for the versions)
  • basic tools such as make, sed, grep
  • meson

For mu4e, you also need emacs, version 28 or later.

Note, support for Windows is very much experimental, that is, it works for some people, but we can't really support it due to lack of the specific expertise. Help is welcome!

Building

$ git clone https://github.com/djcb/mu.git
$ cd mu

mu uses meson for building, so you can use that directly, and all the usual commands apply. You can also use it indirectly through the provided Makefile, which provides a number of useful targets.

For instance, using the Makefile, you could install mu using:

$ ./autogen.sh && make
$ sudo make install

You can of course also run meson directly (see the meson documentation for more details):

$ meson setup build
$ meson compile -C build
$ meson install -C build

Contributing

Contributions are welcome! See the Github issue list and IDEAS.org.

Description
No description provided
Readme 24 MiB
Languages
C++ 59.6%
Emacs Lisp 29.6%
Scheme 4.9%
Meson 2.9%
Shell 1.5%
Other 1.5%