All the time I thought what makes "notmuch new" so abysmally slow is the stat() for each maildir. But as it continued to be slow even after I moved most mails out of 'new' (into 'new-20120624'), I strace'd notmuch and noticed it listed even unchanged directories, thereby listing and iterating over each and every single of the 900k mails in my mail store. There's still quite some room for further improvements as it continues to take several minutes to scan < 100 new mails in changed directories containing < 1000 mails in total. Even the rsync run that fetches the new mails is faster. Sascha Silbe (3): lib: fix NULL checks for filenames iterators lib: add support for rewinding a filenames iterator new: don't read unchanged directories from disk lib/filenames.c | 15 ++++++- lib/notmuch.h | 8 ++++ notmuch-new.c | 130 +++++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 119 insertions(+), 34 deletions(-) -- 1.7.10