unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23223@debbugs.gnu.org
Subject: bug#23223: 25.0.92; Can xref-find-references be sped up?
Date: Thu, 7 Apr 2016 03:11:25 +0300	[thread overview]
Message-ID: <ee794a61-5ff1-f14a-56de-9551fb74daa4@yandex.ru> (raw)
In-Reply-To: <8360vumzk4.fsf@gnu.org>

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.





  reply	other threads:[~2016-04-07  0:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05 15:16 bug#23223: 25.0.92; Can xref-find-references be sped up? Eli Zaretskii
2016-04-06  0:37 ` Dmitry Gutov
2016-04-06 15:09   ` Dmitry Gutov
2016-04-06 17:20     ` Eli Zaretskii
2016-04-06 23:11       ` Dmitry Gutov
2016-04-07  2:49         ` Eli Zaretskii
2016-04-06 17:12   ` Eli Zaretskii
2016-04-07  0:11     ` Dmitry Gutov [this message]
2016-04-07 15:03       ` Eli Zaretskii
2016-04-09  3:12         ` Dmitry Gutov
2016-04-09  7:25           ` Eli Zaretskii
2016-04-10 23:27             ` Dmitry Gutov
2016-04-11 15:56               ` Eli Zaretskii
2016-04-11 23:25                 ` Dmitry Gutov
2016-04-12 15:50                   ` Eli Zaretskii
2016-04-12 18:49                     ` Dmitry Gutov
2016-04-12 19:16                       ` Eli Zaretskii
2016-04-12 20:26                         ` Dmitry Gutov
2016-04-13  2:44                           ` Eli Zaretskii
2016-04-13 10:18                             ` Dmitry Gutov
2016-04-13 15:16                               ` Eli Zaretskii
2016-04-15 14:29                                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee794a61-5ff1-f14a-56de-9551fb74daa4@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=23223@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).