From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: A project-files implementation for Git projects Date: Thu, 03 Oct 2019 10:33:43 +0200 Message-ID: <87r23u9qjc.fsf@gnu.org> References: <8736h9rdc4.fsf@gnu.org> <87mufcfz1u.fsf@gnu.org> <87tv9kz2x6.fsf@gnu.org> <87a7bbjdwe.fsf@gnu.org> <87a7ba8uvx.fsf@gnu.org> <87pnk2zvvy.fsf@gnu.org> <87sgows6wy.fsf@gnu.org> <87ef0dy18z.fsf@gnu.org> <87impk675h.fsf@gnu.org> <874l13h30l.fsf@gnu.org> <7386ef98-c151-e1ce-23fa-11470a16f0d3@yandex.ru> <87h84x1zoa.fsf@gnu.org> <4be972f9-45a3-f2aa-f532-d7b8fbe054fd@yandex.ru> <17994e8f-9940-2da5-216e-20a5d3842822@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="60269"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 03 10:33:56 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iFwYe-000FR3-8Y for ged-emacs-devel@m.gmane.org; Thu, 03 Oct 2019 10:33:56 +0200 Original-Received: from localhost ([::1]:33836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFwYc-00073G-Gi for ged-emacs-devel@m.gmane.org; Thu, 03 Oct 2019 04:33:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42135) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFwYU-00071e-Q2 for emacs-devel@gnu.org; Thu, 03 Oct 2019 04:33:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iFwYU-0000d3-AK; Thu, 03 Oct 2019 04:33:46 -0400 Original-Received: from auth1-smtp.messagingengine.com ([66.111.4.227]:38897) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1iFwYU-0000uO-3Q; Thu, 03 Oct 2019 04:33:46 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 8F14021C1E; Thu, 3 Oct 2019 04:33:45 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 03 Oct 2019 04:33:45 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrgeekgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufhffjgfkfgggtgesthdtredttdertdenucfhrhhomhepvfgrshhsihhl ohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucfkphepkeegrddufedvrdelle drgeeinecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvghsmhhtphgruhht hhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedvleekqdhtshguhheppe hgnhhurdhorhhgsehfrghsthhmrghilhdrfhhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Original-Received: from thinkpad-t440p (p5484632e.dip0.t-ipconnect.de [84.132.99.46]) by mail.messagingengine.com (Postfix) with ESMTPA id 87661D6005B; Thu, 3 Oct 2019 04:33:43 -0400 (EDT) Mail-Followup-To: Dmitry Gutov , emacs-devel@gnu.org In-Reply-To: <17994e8f-9940-2da5-216e-20a5d3842822@yandex.ru> (Dmitry Gutov's message of "Tue, 1 Oct 2019 11:11:43 +0300") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240492 Archived-At: Dmitry Gutov writes: Hi Dmitry, > Here's an updated patch. > > - project--vc-list-files now has '--' in its name. > > - Turns out that sometimes Git repositories include symlinks, and even broken > ones. Grep, subsequently, chokes on those with "file not found", so we now > suppress all "not found" messages from Grep. > > diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el > index 4693d07fa8..4556c0bdb9 100644 > --- a/lisp/progmodes/project.el > +++ b/lisp/progmodes/project.el > @@ -277,6 +277,67 @@ project-try-vc > (funcall project-vc-external-roots-function))) > (project-roots project))) > > +(cl-defmethod project-files ((project (head vc)) &optional dirs) > + (cl-mapcan > + (lambda (dir) > + (let (backend) > + (if (and (file-equal-p dir (cdr project)) > + (setq backend (vc-responsible-backend dir)) > + nil ^^^ So this disables the VC operation. I've removed it, and the speed improvement is good here. This is my test case (the Emacs repository): --8<---------------cut here---------------start------------->8--- (let* ((dir "~/Repos/el/emacs") (p (project-current nil dir)) f1 f2) (let ((t1 (benchmark-run 10 (setq f1 (project-files p)))) (t2 (benchmark-run 10 (setq f2 (project--files-in-directory dir (project--dir-ignores p dir)))))) (message "Files: %d (VC) vs. %d (find)" (length f1) (length f2)) (message "VC) Elapsed time: %fs (%fs in %d GCs)" (car t1) (nth 2 t1) (nth 1 t1)) (message "Find) Elapsed time: %fs (%fs in %d GCs)" (car t2) (nth 2 t2) (nth 1 t2))) (let ((d1 (cl-set-difference f1 f2 :test #'string=)) (d2 (cl-set-difference f2 f1 :test #'string=))) (message "Files found by VC but not by find:") (dolist (f d1) (message " %s" f)) (message "Files found by find but not by VC:") (dolist (f d2) (message " %s" f)))) --8<---------------cut here---------------end--------------->8--- Here is the output: --8<---------------cut here---------------start------------->8--- VC) Elapsed time: 1.379560s (0.308720s in 6 GCs) Find) Elapsed time: 4.397054s (0.200695s in 4 GCs) Files found by VC but not by find: /home/horn/Repos/el/emacs/doc/lispintro/cons-1.pdf /home/horn/Repos/el/emacs/doc/lispintro/cons-2.pdf /home/horn/Repos/el/emacs/doc/lispintro/cons-2a.pdf /home/horn/Repos/el/emacs/doc/lispintro/cons-3.pdf /home/horn/Repos/el/emacs/doc/lispintro/cons-4.pdf /home/horn/Repos/el/emacs/doc/lispintro/cons-5.pdf /home/horn/Repos/el/emacs/doc/lispintro/drawers.pdf /home/horn/Repos/el/emacs/doc/lispintro/lambda-1.pdf /home/horn/Repos/el/emacs/doc/lispintro/lambda-2.pdf /home/horn/Repos/el/emacs/doc/lispintro/lambda-3.pdf /home/horn/Repos/el/emacs/etc/refcards/Makefile /home/horn/Repos/el/emacs/etc/refcards/gnus-logo.pdf /home/horn/Repos/el/emacs/lib/_Noreturn.h /home/horn/Repos/el/emacs/lib/stdalign.in.h /home/horn/Repos/el/emacs/lib/stddef.in.h /home/horn/Repos/el/emacs/lib/stdint.in.h /home/horn/Repos/el/emacs/lib/stdio-impl.h /home/horn/Repos/el/emacs/lib/stdio.in.h /home/horn/Repos/el/emacs/lib/stdlib.in.h /home/horn/Repos/el/emacs/m4/__inline.m4 /home/horn/Repos/el/emacs/test/data/xdg/mimeinfo.cache /home/horn/Repos/el/emacs/test/lisp/progmodes/flymake-resources/Makefile /home/horn/Repos/el/emacs/test/manual/etags/Makefile /home/horn/Repos/el/emacs/test/manual/etags/make-src/Makefile /home/horn/Repos/el/emacs/test/manual/indent/Makefile Files found by find but not by VC: /home/horn/Repos/el/emacs/aclocal.m4 /home/horn/Repos/el/emacs/config.status /home/horn/Repos/el/emacs/configure /home/horn/Repos/el/emacs/info/dir --8<---------------cut here---------------end--------------->8--- Then I did it on a clean checkout of the gtk repository and got this result: --8<---------------cut here---------------start------------->8--- Files: 4774 (VC) vs. 4774 (find) VC) Elapsed time: 1.721054s (0.461112s in 9 GCs) Find) Elapsed time: 0.634624s (0.152549s in 3 GCs) Files found by VC but not by find: Files found by find but not by VC: nil --8<---------------cut here---------------end--------------->8--- So here, Git has been much slower that find! And again with gnulib: --8<---------------cut here---------------start------------->8--- Files: 9936 (VC) vs. 9936 (find) VC) Elapsed time: 3.444869s (0.902124s in 16 GCs) Find) Elapsed time: 1.380269s (0.285082s in 5 GCs) Files found by VC but not by find: Files found by find but not by VC: --8<---------------cut here---------------end--------------->8--- Again Git was slower. What my gtk and gnulib repositories have in common is that they are clean, i.e., no build artifacts which would be matched by the exclude args passed to find... Bye, Tassilo