From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 5E08D6DE3C4F for ; Sat, 24 Jun 2017 12:27:12 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ruz_LDNYVsqP for ; Sat, 24 Jun 2017 12:27:11 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id B0C986DE3C4E for ; Sat, 24 Jun 2017 12:27:11 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1dOqf0-0007YI-H0; Sat, 24 Jun 2017 15:23:58 -0400 Received: (nullmailer pid 4491 invoked by uid 1000); Sat, 24 Jun 2017 19:27:06 -0000 From: David Bremner To: Piotr Trojanek , notmuch@notmuchmail.org Subject: Re: High CPU usage on Tree View with many emails In-Reply-To: References: Date: Sat, 24 Jun 2017 16:27:06 -0300 Message-ID: <87wp81mbjp.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jun 2017 19:27:12 -0000 Piotr Trojanek 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.