Subject: bug#63651: possible eglot xref-find-references optimization

From: Dmitry Gutov <[email-masked]>
Date: Sat, 5 Oct 2024 02:36:30 +0300

Hi!

On 04/07/2023 16:55, Alan Donovan via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> Any progress? Were you able to observe the problem?

Sorry this report got dropped.

I've tried reproducing and see some difference when using Emacs 29. 
Since as you mention it's due to find-buffer-visiting call, this likely 
only manifests with a significant number of buffers open.

'git blame' on the call in question leads to 
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=306feb7d967e - I 
haven't dug in too much further to say more.

But I suggest you retry your scenario using Emacs 30 (currently in 
pretest) - performance of find-buffer-visiting is improve in it. Seems 
to make a difference here.

> cheers
> alan
> 
> On Wed, 24 May 2023 at 17:22, Alan Donovan <[email-masked]> wrote:
>>
>> On Wed, 24 May 2023 at 12:29, João Távora <[email-masked]> wrote:
>>> Thanks for reporting this Alan, it is an interesting point. (Next time you can add me on CC directly so that i don't miss the message in this list, which i don't always track closely)
>>
>> Will do.
>>
>>> Could you provide a test case where these ~= 1300 xref matches are produced? I suppose it is some Go repository? With a standard gopls? But which file/position and which command should one use?
>>
>> $ git clone https://github.com/golang/tools
>> $ cd tools
>> $ (cd gopls && go install)   # if you don't have it already
>> $ emacs gopls/internal/lsp/cache/analysis.go
>> Then search for fmt.Sprintf (e.g. on L246) and do xref-find-references
>> on it. I get about 1300 matches.
>>
>> cheers
>> alan
> 
> 
>