From: Mattias Engdegård Date: Wed, 15 Sep 2021 11:47:15 +0000 (+0200) Subject: Faster grep pattern for identifiers X-Git-Tag: emacs-28.0.90~953 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=544db1ee8679eec9edd5cee81a340ee1c4d70158;p=emacs.git 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. --- diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index cee54d78185..e06a3c10078 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)