From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#50733: 28.0.1; project-find-regexp can block Emacs for a long time Date: Wed, 22 Sep 2021 23:58:42 +0200 Message-ID: References: <03aa81b5-6077-c35c-1a5f-ec4d867b59ac@yandex.ru> Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4573"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) Cc: 50733@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 23 00:01:19 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 1mTAIp-00012b-3O for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Sep 2021 00:01:19 +0200 Original-Received: from localhost ([::1]:55460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTAIo-0006Yx-3a for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Sep 2021 18:01:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTAIY-0006X1-NO for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 18:01:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTAIX-0001tm-Q1 for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 18:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mTAIX-0004VF-OX for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 18:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Sep 2021 22:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50733 X-GNU-PR-Package: emacs Original-Received: via spool by 50733-submit@debbugs.gnu.org id=B50733.163234805917201 (code B ref 50733); Wed, 22 Sep 2021 22:01:01 +0000 Original-Received: (at 50733) by debbugs.gnu.org; 22 Sep 2021 22:00:59 +0000 Original-Received: from localhost ([127.0.0.1]:52024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTAIT-0004R9-I5 for submit@debbugs.gnu.org; Wed, 22 Sep 2021 18:00:59 -0400 Original-Received: from sonic313-5.consmr.mail.ir2.yahoo.com ([77.238.179.244]:42194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTAIO-0004GT-AW for 50733@debbugs.gnu.org; Wed, 22 Sep 2021 18:00:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1632348045; bh=U7UChUsGpLlkMDMpApMQGV6Bkkn7/VP8KqZw2TKpU8s=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=LJxp0itQKPYIfLQyXxMfblKgo3gcb1f507NoOisjyndtE6ojMtTwZeRPGGtHe5w2STcdmGLjWQfuGlQrNmbEMvdJjBewsQ4qcRSv28pKAHepwzRzwEZiUbhuG07sx9/XXOxtSc3qBxnxLdcKs0m5mxHazio6MFqy0YVcAGpWG/TrrFaYVMfcZCNUyk/isijpd/8rPiWd1h0emmfNehwjE4qF229KMvbH+0YLuZOvm2w6iS0sjoui9BNpdauxCGDYbMmqMfA1HgD8I+6oRrDLtzlkbmMG/TniWknI9LZdbdhdcrkkFKzRFQTSPVMFk+2o4/zK357sITCG2ho4YkMqfw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1632348045; bh=A9WKTBIZIbL4HosjTU+gEZA1W6ynIixrn2lReI1kog3=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=avBvNZhrLGxrUWJlW+M4zPAEqCL9womT/aAbYFzbaTCRbfao1YXOgKzJ7Wl6WT6v1YYr/7NmchSY3kYwh0XwdyN8J7O0UFeWpscHsU933N679WPpbQQwVhXm8KaEgL370yN8H2l4v1yN9rfzv50sa1SNOCkpsFcDrbZh6UyTsOmaxYsx8NWchYEz1pqR1xyDQxZTxSvp0ivUOcqks9Hf9f8Eby8S0ZvmcBHshtBliryusX1Cxe6gPzQSlJ8j9cWgm3GBJ4wgF4oerjHY/omj86CusZtPcy7bC0FRtcvA9vQ5NQK/Iy+zE+NQKg7np2eHtS+JRiOZMSz3ss0S11PvqQ== X-YMail-OSG: ji4.L3EVM1m74KpuTgA9_BgtbEQDgL5UvFyBOyRFIrEbZE_8A8mmSaChuVI959c 60wuP98KmoXdzgkOi.7yZC2Du_jWa0I294Ho1j59YyaIyo_NNztSMfpxd9xROaXlExLUrgeeKni_ CxoZiPDBmGkO.2PNHVABecCGgEmaS3wXHdTdFbjofxewVwP_kON4kzEQPnljSkq7kJ4CVtMIHpmJ BuLDP1eAzGp4GKDpWytqkGqlzwu0J6N6lpbUd6H_W4zVtwU9qeswi07uE4Q1yUUFOjAuFir.h6w1 qIxV7TR1YLFCgV9OxcV8jMWwU6oGSiducdVXd0pEIPimbX7AVjeGIGunmzdvusF0WuA3GmiLAU.F bWExsGPnmdEaaW1mT4lIXIKYwag9yl8UUi63vvVe8Xsiw1muJmIj0yTYNgwL7O.LoF_p0olot0ov e81QC7a025vhOMh15Nwt67ZB12xwPXJ9nGDQf3cO8xlM.dJWsIFJITZF9POxm6eIIsRn89EFjDat q4erHw5egoNZmQ8fIep4L_mHvzqF0VpJMYwAnUl_FZkMO21xdZIoMaJrfd_fvoNPHWg9k5JDdiuG _OlL5JZwVz.OaaCfGcIGj1YLVkxDQzCVkxV5iylmbmtlA6qCMd5Tt_5VIkFCmN.uzZ3J1J5M1oGd yErG1qEif_ffv8wZSQU2hYtAoid_lSdhYaYrmSdCjbsM9_CRQUT.MoROmD2tlX9f1f7fi9HEX4RZ qKewBD8CU_RwRztd1B7mNcAaHxQbGD0q1b5suzEh0bOB2YD_XZVdanZ3RaiP71IBNsA0UQ.6Mmkt 0LJ5pOIfGbcG2mnMr2ZSTaiYfntp9AJkPQ68bnfPHl X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Wed, 22 Sep 2021 22:00:45 +0000 Original-Received: by kubenode531.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 926746b2dcfe19659c965edd3071201b; Wed, 22 Sep 2021 21:58:44 +0000 (UTC) In-Reply-To: <03aa81b5-6077-c35c-1a5f-ec4d867b59ac@yandex.ru> (Dmitry Gutov's message of "Wed, 22 Sep 2021 22:09:43 +0300") X-Mailer: WebService/1.1.19043 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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:215145 Archived-At: Dmitry Gutov writes: > > IIRC you are using macOS. I received another report recently that > find/grep based tooling, and project-find-regexp in particular, are > pretty slow on that OS. Yes, this is on macOS. > > When you say "block for a long time", how long are we talking about? >> > To try it, evaluate > > (benchmark 1 '(project-find-regexp "new-collection")) I usually work on a monorepo with ~67000 tracked files (many of them big binary files). Here's what I get when using ripgrep as the xref search program: Elapsed time: 36.087181s (8.067474s in 22 GCs) Running the same search with ripgrep from the command line takes around 6 seconds. > > Another benchmark to try is > > (benchmark 1 '(project-files (project-current))) Elapsed time: 1.590223s (0.432372s in 1 GCs) Here's an ELisp profile of the first benchmark: 8696 78% - command-execute 8696 78% - call-interactively 8493 76% - funcall-interactively 8480 76% - eval-expression 8479 76% - eval 8479 76% - project-find-regexp 8227 74% - xref--show-xrefs 8227 74% - xref--show-xref-buffer 5584 50% - # 5584 50% - apply 5584 50% - project--find-regexp-in-files 5574 50% - xref-matches-in-files 3016 27% - xref--convert-hits 3000 27% - mapcan 2992 27% - # 2734 24% - xref--collect-matches 2094 18% - xref--collect-matches-1 800 7% + xref-make-match 774 7% + xref-make-file-location 104 0% xref--find-file-buffer 80 0% file-remote-p 51 0% xref--regexp-syntax-dependent-p 906 8% + xref--process-file-region 331 2% sort 1413 12% + xref--analyze 1230 11% + xref--show-common-initialize 249 2% + project-files 3 0% + project-current 9 0% + minibuffer-complete 4 0% + execute-extended-command 203 1% + byte-code 2314 20% - ... 2314 20% Automatic GC 27 0% + timer-event-handler The search time is reduced when I use a more specific search term, presumably because the number of results is lower and the Elisp post-processing takes less time. Here's what I got, for example, when I search for something with results from only one file: Elapsed time: 6.859815s (0.864738s in 2 GCs) Compared to the time taken by the same query from the command line (6.5s) shows that the Elisp post-processing time is probably negligible in this scenario.