From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#49264: 28.0.50; project.el+tramp performance issue Date: Tue, 29 Jun 2021 15:05:35 +0300 Message-ID: <83mtr8ooz4.fsf@gnu.org> References: <87fsx13aiz.fsf.ref@aol.com> <87fsx13aiz.fsf@aol.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13592"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49264@debbugs.gnu.org To: Ergus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 29 14:06:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyCVH-0003Fd-7t for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Jun 2021 14:06:11 +0200 Original-Received: from localhost ([::1]:51966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyCVF-0000ch-ES for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Jun 2021 08:06:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyCV8-0000cL-RT for bug-gnu-emacs@gnu.org; Tue, 29 Jun 2021 08:06:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyCV8-0005R3-Jw for bug-gnu-emacs@gnu.org; Tue, 29 Jun 2021 08:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lyCV8-0003KD-Bw for bug-gnu-emacs@gnu.org; Tue, 29 Jun 2021 08:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Jun 2021 12:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49264 X-GNU-PR-Package: emacs Original-Received: via spool by 49264-submit@debbugs.gnu.org id=B49264.162496834312753 (code B ref 49264); Tue, 29 Jun 2021 12:06:02 +0000 Original-Received: (at 49264) by debbugs.gnu.org; 29 Jun 2021 12:05:43 +0000 Original-Received: from localhost ([127.0.0.1]:53786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyCUo-0003Jd-Jf for submit@debbugs.gnu.org; Tue, 29 Jun 2021 08:05:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyCUn-0003JR-7Q for 49264@debbugs.gnu.org; Tue, 29 Jun 2021 08:05:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51772) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyCUh-00058m-OQ; Tue, 29 Jun 2021 08:05:35 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1397 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyCUh-00058G-A7; Tue, 29 Jun 2021 08:05:35 -0400 In-Reply-To: <87fsx13aiz.fsf@aol.com> (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:209095 Archived-At: > Date: Tue, 29 Jun 2021 00:11:00 +0200 > From: Ergus via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Using tramp I tried to use project.el with a command like > project-switch-to-buffer and it took like 10 minutes to complete. > > I ran a profiler and I found that most of the time was taken by an > external function: global-tags-try-project-root That doesn't follow from the profile you show. According to the profile, global-tags-try-project-root takes just 6% of the CPU time. > project-current is called in a loop for all the opened buffers it calls > project--find-in-directory that calls project-find-functions and there > is going all the time. I don't see project-find-functions in the profile. Where is it and how does it come into this picture? > After some optimization in an external package; now the time is half > than before but still very slow to use the command (around 3-5 minutes > to complete) and running again the profiler I get this: > > 5637 89% - command-execute > 5549 88% - byte-code > 5549 88% - project--read-project-buffer > 5549 88% - let* > 5336 85% - read-buffer > 5323 84% - ivy-completing-read > 5323 84% - ivy-read > 4941 78% - ivy--reset-state > 4941 78% - ivy--buffer-list > 4941 78% - internal-complete-buffer > 4941 78% - # > 4941 78% - and > 4941 78% - equal > 4941 78% - save-current-buffer > 4941 78% - project-current > 4941 78% - project--find-in-directory > 4548 72% - project-try-vc > 4537 72% - vc-responsible-backend > 4478 71% - # > 4478 71% - vc-call-backend > 4478 71% - apply > 1470 23% + vc-svn-responsible-p > 1142 18% + vc-bzr-responsible-p > 970 15% + vc-hg-responsible-p > 390 6% + vc-git-responsible-p > 156 2% + vc-cvs-responsible-p > 126 2% + vc-rcs-responsible-p > 108 1% + vc-sccs-responsible-p > 98 1% + vc-src-responsible-p > 57 0% + tramp-file-name-handler > 11 0% + vc-file-getprop > 393 6% + global-tags-try-project-root > 375 5% + read-from-minibuffer > 13 0% + if > 213 3% + project-current > 88 1% + funcall-interactively > 572 9% + ... > 51 0% + timer-event-handler > 8 0% + redisplay_internal (C function) > > > As you can see most of the time is still taken by project-current and I > can't really understand why: AFAICT, most of the time is taken by 'apply', but the profile doesn't show which function is called by 'apply'. Can you tell which function is that? > 1) Are so many samples 4548 seems a very high number for only 25 opened > buffers. These two numbers are unrelated. 4548 is the number of time the profiler found the program counter inside project-try-vc and the functions it calls. This number has no relation to the number of buffers you have, it just means that code runs slowly. > 2) why project-try-vc still takes so much...? Specially for unfrequent > vc systems in our days like svn or bzr that I am not using. That was explained on emacs-devel. However, ... > As a workaround I removed all the uninteresting handlers from > vc-handled-backends and I get better times now, but IMHO it is still > very inefficient (almost a minute for project-switch-to-buffer is > excessive). And make it practically unusable. ... after removing the "unused" VC back-ends, you say that the code still runs very slowly. So is the issue with VC back-ends still relevant, and if so, how? More importantly, what is the profile after you remove the extra VC calls? > VCS changing is not something that happens very often to require a check > of all the backends everytime, several times for every buffer in many > project.el functions right? Specially when using tramp. Once again, given what you say above, this doesn't sound important, does it? The slow processing is elsewhere, and without seeing a profile with VC calls removed, it's hard to make progress in this matter, or give you some advice regarding potential reason(s). > vc has vc-file-prop-obarray; maybe vc-responsible-backend should cache > it's result there to avoid repeating time consuming computations? Again: is this issue relevant, given that without the VC calls the code is still very slow?