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#62837: [PATCH] Add a semantic-symref backend which uses xref-matches-in-files Date: Sat, 15 Apr 2023 01:38:18 +0300 Message-ID: <5e6eddd5-4b38-5765-05f3-dd6c1927edd3@yandex.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14633"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 To: Spencer Baugh , 62837@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 15 00:39:22 2023 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 1pnS4g-0003ck-7C for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Apr 2023 00:39:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pnS4O-0000jB-Bj; Fri, 14 Apr 2023 18:39:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pnS4N-0000ik-5E for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 18:39:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pnS4M-0006gG-SZ for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 18:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pnS4M-0005cc-1f for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 18:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Apr 2023 22:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62837 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62837-submit@debbugs.gnu.org id=B62837.168151190921565 (code B ref 62837); Fri, 14 Apr 2023 22:39:02 +0000 Original-Received: (at 62837) by debbugs.gnu.org; 14 Apr 2023 22:38:29 +0000 Original-Received: from localhost ([127.0.0.1]:47876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnS3o-0005bl-Ud for submit@debbugs.gnu.org; Fri, 14 Apr 2023 18:38:29 -0400 Original-Received: from forward500c.mail.yandex.net ([178.154.239.208]:43774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnS3l-0005ba-SZ for 62837@debbugs.gnu.org; Fri, 14 Apr 2023 18:38:27 -0400 Original-Received: from mail-nwsmtp-smtp-production-main-91.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-91.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:24a7:0:640:a059:0]) by forward500c.mail.yandex.net (Yandex) with ESMTP id 9A2D75EEE6; Sat, 15 Apr 2023 01:38:23 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-91.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id LchmbLMsKa60-DmeSKLRv; Sat, 15 Apr 2023 01:38:23 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1681511903; bh=tobdHGa7575h7NPYGZnCF/v9XtYLyIhKc6nCHrmhNek=; h=In-Reply-To:From:Subject:Message-ID:References:Date:To; b=DBxdyDU5IX3uNCt9LMrvkuWhrYCOFNLu0gS4dBXkQEPvti8by7OPIGjDiM2Spdwbr zaZRVMq8iQ/nobbAUQDCiUkknNtJuVjAYPygLx04hIxgRm4ysaE8gX5EdPV4WesLvu dcrh0sR5+hbzA7Vl45MUrqGPNo1O0L4cQxeAzSOc= Authentication-Results: mail-nwsmtp-smtp-production-main-91.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailauth.nyi.internal (Postfix) with ESMTP id 6232A27C0054; Fri, 14 Apr 2023 18:38:21 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 14 Apr 2023 18:38:21 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeluddgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughguhhtohhvseihrghnuggvgidrrhhuqeenucggtffrrghtth gvrhhnpeeludeigeejledutdeikedttddtgfeufeejkeelheeftedutdegteeufeelleff leenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepughguhhtohhvodhmvghsmhhtphgruhhthhhp vghrshhonhgrlhhithihqddufeeffeelleehhedvqddvleegjeejjeejiedqughguhhtoh hvpeephigrnhguvgigrdhruhesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: ib1d9465d:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Apr 2023 18:38:20 -0400 (EDT) Content-Language: en-US In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:259983 Archived-At: Hi! On 14/04/2023 18:37, Spencer Baugh wrote: > When project-files is available, this is a much more efficient > fallback than the current grep fallback. Ultimately, this is > motivated by making xref-find-references faster by default even in the > absence of an index. It's a clever enough idea, but unfortunately it doesn't look like the performance is always improved by this change. E.g. I have this checkout of gecko-dev (a big project, just for testing: https://github.com/mozilla/gecko-dev) which contains different types of files: cpp, js, py. If I do an xref-find-references search with the current code, it finishes in around ~0.8s. 'find' is not that slow, actually: time find . -type f -name "*.cpp" >/dev/null reports just 400 ms here. Whereas with your patch the search, depending on the language (cpp -- more files, py -- less files) can take 3 seconds and more. Why? First of all, project-files returns all files (which are then all searched), whereas semantic-symref-filepattern-alist contains a mapping from modes to file globs, limiting both the scan and subsequent search to those. Second -- using project-files means we're forced to round-trip the list of files names from the first project's stdout, to buffer, then to a list of Lisp strings, and then back to another buffer, to use as stdin. I have a couple of things planner in the medium term to improve that, but some overhead is probably unavoidable (unless we get some new primitive that would allow "piping" between process buffers). Perhaps you could describe your case where you *did* see a significant improvement from this patch, and we can discuss the best steps to address that. BTW, at first I figured you're using MacOS (which historically has bundled outdated versions of find and grep, with worse performance). But apparently not?