emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 544db1e: Faster grep pattern for identifiers


From: Dmitry Gutov
Subject: Re: master 544db1e: Faster grep pattern for identifiers
Date: Wed, 15 Sep 2021 19:25:25 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 15.09.2021 18:56, Eli Zaretskii wrote:
branch: master
commit 544db1ee8679eec9edd5cee81a340ee1c4d70158
Author: Mattias Engdegård<mattiase@acm.org>

     Faster grep pattern for identifiers
* lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search):
     Use the `-w` flag instead of wrapping the pattern in regexps that make
     matching much slower.  This speeds up `xref-find-references` by about
     3× on macOS.
Doesn't this change the semantics of the "word"?  The Grep notion of
the word is not necessarily identical to that of Emacs, since the
latter depends on the major mode.  The comment in the deleted code
says that much, AFAICT.  Or what am I missing?

Luckily, -w actually corresponds to the regexp which the previous version of the code was using. Rather than to \<...\> which one might surmise from reading the docs for some versions of Grep (or Ripgrep).

And the comment was about \< and \>.

The latest Grep manual describes it correctly:

       -w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the
              underscore.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]