emacs-diffs
[Top][All Lists]
Advanced

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

master 544db1e: Faster grep pattern for identifiers


From: Mattias Engdegård
Subject: master 544db1e: Faster grep pattern for identifiers
Date: Wed, 15 Sep 2021 07:54:34 -0400 (EDT)

branch: master
commit 544db1ee8679eec9edd5cee81a340ee1c4d70158
Author: Mattias Engdegård <mattiase@acm.org>
Commit: 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.
---
 lisp/cedet/semantic/symref/grep.el | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/lisp/cedet/semantic/symref/grep.el 
b/lisp/cedet/semantic/symref/grep.el
index cee54d7..e06a3c1 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -150,15 +150,8 @@ This shell should support pipe redirect syntax."
                            "-l ")
                           ((eq (oref tool searchtype) 'regexp)
                            "-nE ")
-                          (t "-n ")))
-         (greppat (cond ((eq (oref tool searchtype) 'regexp)
-                         (oref tool searchfor))
-                        (t
-                         ;; Can't use the word boundaries: Grep
-                         ;; doesn't always agree with the language
-                         ;; syntax on those.
-                         (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)"
-                                 (oref tool searchfor)))))
+                          (t "-nw ")))
+         (greppat (oref tool searchfor))
         ;; Misc
         (b (get-buffer-create "*Semantic SymRef*"))
         (ans nil)



reply via email to

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