From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov 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 22:09:43 +0300 Message-ID: <03aa81b5-6077-c35c-1a5f-ec4d867b59ac@yandex.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26344"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 To: Daniel =?UTF-8?Q?Mart=C3=ADn?= , 50733@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 22 21:18:25 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 1mT7lB-0006jI-PI for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Sep 2021 21:18:25 +0200 Original-Received: from localhost ([::1]:47628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mT7lA-0001e7-CE for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Sep 2021 15:18:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mT7d4-00067Y-Ae for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 15:10:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40172) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mT7d3-00068p-VW for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 15:10:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mT7d3-0004c9-Of for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 15:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Sep 2021 19:10: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.163233779417711 (code B ref 50733); Wed, 22 Sep 2021 19:10:01 +0000 Original-Received: (at 50733) by debbugs.gnu.org; 22 Sep 2021 19:09:54 +0000 Original-Received: from localhost ([127.0.0.1]:51716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mT7cw-0004ba-9w for submit@debbugs.gnu.org; Wed, 22 Sep 2021 15:09:54 -0400 Original-Received: from mail-wr1-f53.google.com ([209.85.221.53]:44590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mT7cu-0004bG-2u for 50733@debbugs.gnu.org; Wed, 22 Sep 2021 15:09:53 -0400 Original-Received: by mail-wr1-f53.google.com with SMTP id d6so9871778wrc.11 for <50733@debbugs.gnu.org>; Wed, 22 Sep 2021 12:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=THOm8K9EI3y4vbIzh7ej6E7KMu8ICVC9KFdtGJhawls=; b=ODjGtOplSN638R3bv3Oxa/IN0xg20MxIWJI3iWAJoMnDuISgTwYj3S5ZiVe3h6BkhV CgT0IyN50mCtGCr600a3j1bAWB24T/ftkpKLV4U+c5WOrmWudqJkDlsPYVU6+u6A0gah PLf2yjtK5rGYfodrsk+cD+mg6W1OgxytxWnOqt06iWHzB5qA4PnTOfuohRoPP39M0o72 vtFNglnxW4tNjpSnECPmJbRWeE+kwfwCjAOeQkVpVXvgECjXapOwcRdEQiIx0jLn90Pj XNosQOTB946MNLo5T1h7L2CMDbWD5Lx5MNYUU+viC8QBb2szJfw8IXjhtbpdfWWv1l2f hlsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=THOm8K9EI3y4vbIzh7ej6E7KMu8ICVC9KFdtGJhawls=; b=WgErWcklSXw/DKgMJwzniyt+sp+IzkWQ+b0uDP9XqYhwJu1wBVHlkB7Xh/03dQAQ30 X43EstyPaWlMNc2diok5GfmChTkIs8p6yt7zinBCam6KDPHu5j0IN6DfI6LgxV2NHOWm NoX42x3FzrTPcPr+JmHC12Xx+iTUSLB7O9zwDwoQ5VpmqEtHIiA1UPE4ucSgp21+Ov7g AbCrUCjfRdtmpRRgHALrE1l5rZCIhwNoj6KGwOe0d5wLDuHLSl8gDMWpyyoU+mR9Vqv2 T2oH77rChNKFoNTVEK4eVQO9ENg1jRkFLabKnVFZBVWgroS/AxpudAT7fWOiXYpqAZUL jJLQ== X-Gm-Message-State: AOAM532/X9xL3gsjLDJ5eF4cPC76w438W4nJoh1EoMUgEleMUc0aK45O XyQEwnhyl2ZVPsI5HtxCGBPcVlshMd4= X-Google-Smtp-Source: ABdhPJx0YcEu4PiDzF/PaVGEPKfXH901ervblOxoiNS3GRESAO4//4o3a+9aGEvZz85prNUXLzphVg== X-Received: by 2002:a1c:751a:: with SMTP id o26mr698302wmc.94.1632337786001; Wed, 22 Sep 2021 12:09:46 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id d1sm2617843wrr.72.2021.09.22.12.09.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Sep 2021 12:09:45 -0700 (PDT) In-Reply-To: Content-Language: en-US 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:215118 Archived-At: Hi Daniel, On 22.09.2021 12:27, Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > > When trying to search in a big project with thousands of files using > `project-find-regexp`, Emacs can synchronously block for a long time > until the results are computed for display in an *xref* buffer. > > In contrast, the rgrep command and friends create a `grep-mode` buffer > and asynchronously fill it with results as they are computed by the grep > tool. Emacs is not blocked and the user can start exploring matches > right away. > > Is there a plan to eventually replace `grep-mode` with `xref-mode` in > Emacs? No solid plan to replace everything (a lot of people will object, for various reasons), but it's the direction I want to see. At least in a core set of IDE-ish commands. > If so, I think that computing results asynchronously is the most > important feature we'll lose. When using `xref-mode` with an index > (etags, for example), the blocking is not noticeable; but when using a > grep tool the delay can be annoying if the repository is huge. Non-blocking UI for Xref is possible, but it requires a fair amount of work, possibly some low-level one. Not in the cards for Emacs 28, at least. But maybe we could improve things another way first. 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. When you say "block for a long time", how long are we talking about? For reference, when a do a search across Emacs sources checkout, and there are few matches, it returns in ~100ms (with warm cache and SSD disk, to be clear). To try it, evaluate (benchmark 1 '(project-find-regexp "new-collection")) And a similar search across the Linux kernel source tree takes ~1s. The first thing to try is to either install the latest GNU Grep and make sure Emacs uses it, or install ripgrep and (setq xref-search-program 'ripgrep) Please report if that helps and how much. Another benchmark to try is (benchmark 1 '(project-files (project-current)))