High CPU usage on Tree View with many emails
David Bremner
david at tethera.net
Sat Jun 24 12:27:06 PDT 2017
Piotr Trojanek <piotr.trojanek at gmail.com> writes:
> When I make a query that gives many results (e.g. "review", which hits
> ~2200 emails with my Gerrit reviews) and want to display them in Tree
> View, the CPU usage stays high for several seconds.
>
> While this happens, the Emacs window flickers, like it was busy with
> redisplaying the buffer. If I pull the horizontal scroll of the Emacs
> buffer down, I can see that the buffer grows (like messages being
> inserted there). The Emacs profiler says that more than 50% of CPU
> time is spend in notmuch-tree-insert-forest-thread.
>
> Interestingly, the in the non-tree view the same query is processed in no time.
>
I suspect the notmuch-search call is taking longer than you think, but
isn't as annoyoying because of the lack of flicker. You can watch the
notmuch process running in e.g. top to see how long it is running.
I don't really know what's going on there, but I noticed that
notmuch-tree is producing about 3 times as manny calls to
redisplay_internal.
The other thing I observed is that the call to "notmuch show" used by
notmuch-tree takes about 3x as long as the call to "notmuch search" used
by M-x notmuch-search; that's with hot caches. It also produces about 4
x as much output, even using --body=false.
All of those experiments are with a query that returns about 35k messages.
More information about the notmuch
mailing list