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.
This commit is contained in:
Mattias Engdegård 2021-09-15 13:47:15 +02:00
parent 83557511a7
commit 544db1ee86

View file

@ -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)