unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* High CPU usage on Tree View with many emails
@ 2017-06-16 15:34 Piotr Trojanek
  2017-06-24 19:27 ` David Bremner
  2017-06-25  8:28 ` Mark Walters
  0 siblings, 2 replies; 3+ messages in thread
From: Piotr Trojanek @ 2017-06-16 15:34 UTC (permalink / raw)
  To: notmuch

Hi,

I am trying notmuch + notmuch-emacs version 0.23.5-1~bpo8+1 from
debian jessie backports, and reproduced this issue with both emacs
24.4 (jessie) and 24.5+1-6~bpo8+1 (jessie backports).

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.

Any idea?

-- 
Piotr Trojanek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: High CPU usage on Tree View with many emails
  2017-06-16 15:34 High CPU usage on Tree View with many emails Piotr Trojanek
@ 2017-06-24 19:27 ` David Bremner
  2017-06-25  8:28 ` Mark Walters
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2017-06-24 19:27 UTC (permalink / raw)
  To: Piotr Trojanek, notmuch

Piotr Trojanek <piotr.trojanek@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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: High CPU usage on Tree View with many emails
  2017-06-16 15:34 High CPU usage on Tree View with many emails Piotr Trojanek
  2017-06-24 19:27 ` David Bremner
@ 2017-06-25  8:28 ` Mark Walters
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Walters @ 2017-06-25  8:28 UTC (permalink / raw)
  To: Piotr Trojanek, notmuch


Hi

> 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.

Yes I see this but I don't quite know why it happens. I think it is to
do with the special tree graphics characters. Two things you could try
are running emacs in a terminal, and changing the font. If you are happy
compiling from source, then you could also try changing the characters
used for the tree graphics (in emacs/notmuch-tree.el)

If you are feeling more adventurous I think the flicker is fixed in
emacs master, so emacs 26 should be OK. (*)

Best wishes

Mark

(*) For an entertaining description of quite what was needed to make
emacs double buffer its output see
https://www.facebook.com/notes/daniel-colascione/buttery-smooth-emacs/10155313440066102/




> 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.
>
> Any idea?
>
> -- 
> Piotr Trojanek
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-25  8:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16 15:34 High CPU usage on Tree View with many emails Piotr Trojanek
2017-06-24 19:27 ` David Bremner
2017-06-25  8:28 ` Mark Walters

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).