GNU bug report logs - #23223
25.0.92; Can xref-find-references be sped up?

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Tue, 5 Apr 2016 15:17:02 UTC

Severity: normal

Found in version 25.0.92

Fixed in version 25.1

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 23223 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23223 <at> debbugs.gnu.org
Subject: Re: bug#23223: 25.0.92; Can xref-find-references be sped up?
Date: Thu, 7 Apr 2016 03:11:25 +0300
On 04/06/2016 08:12 PM, Eli Zaretskii wrote:

> But using plain Grep has the same problem: Grep reports the hits, and
> we then go ahead and visit each hit, right?

Using Grep has the slowness problem, but it doesn't have this 
opportunity for optimization, since Grep definitely doesn't know what 
characters constitute a symbol in different languages. But your proposal 
may speed up Grep searches too, so that's a plus.

>> How do I find the appropriate 'buffer' match in this line?
>
> You already have the code that looks for the match in each line.  What
> I had in mind is looking in the output of Grep or lid, instead of
> visiting the file and looking in that file's buffer.  Does this make
> sense?

Yes, but the search for \_<eval-when\_> needs a properly set syntax 
table, syntax-propertize-function, and possibly other variables that the 
latter might depend on. Basically, it needs a buffer in the right major 
mode. And switching major modes is actually not cheap:

(benchmark 230 '(with-temp-buffer (c-mode)))

=> 1.20s

in my working Emacs instance (much faster in a pristine one, 
admittedly). But I'll have a try at doing this while reusing the 
temporary buffer.

Some major modes could also trip over incomplete source code, but we'll 
get to that when we see that. Syntax highlighting seems out of the 
question, though, with high likelihood of getting it wrong.

We also have the possibility of syntax-propertize-function not applying 
the correct syntax classes to the code fragment because it doesn't see 
the whole file, but I guess it's a small-ish price to pay for the 
performance improvement, and could be fixed on a case-by-case basis.

>> Or can we ask 'lid' (and, ideally, Grep too) to include the column of a
>> match in the output?
>
> No, I don't think such an option exists.  It could be a great
> enhancement request, though ;-)

I was hoping you could serve as a liaison in that, being the sole user 
of id-utils that I know of, so far.

But anyway, if there is no such feature now, we have to choose another 
solution in Emacs 25.1. Even if id-utils were to add this today, it 
would take time to trickle to the majority of our users.

The bar is actually higher: to make use of the enhancement, we'd need 
Global and CScope to support it, too, or at least to be able to detect 
the feature at runtime.




This bug report was last modified 9 years and 92 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.