mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Prefer to run find and grep in parallel in rgrep (bug#71094)
* lisp/progmodes/grep.el (grep-compute-defaults): Prefer `gnu' for grep-find-use-xargs over `exec-plus', but not on Windows. (bug#71094)
This commit is contained in:
parent
65bd41d1cf
commit
f7725d85f3
1 changed files with 12 additions and 4 deletions
|
|
@ -827,15 +827,23 @@ The value depends on `grep-command', `grep-template',
|
||||||
(unless grep-find-use-xargs
|
(unless grep-find-use-xargs
|
||||||
(setq grep-find-use-xargs
|
(setq grep-find-use-xargs
|
||||||
(cond
|
(cond
|
||||||
((grep-probe find-program
|
;; For performance, we want:
|
||||||
`(nil nil nil ,(null-device) "-exec" "echo"
|
;; A. Run grep on batches of files (instead of one grep per file)
|
||||||
"{}" "+"))
|
;; B. If the directory is large and we need multiple batches,
|
||||||
'exec-plus)
|
;; run find in parallel with a running grep.
|
||||||
|
;; "find | xargs grep" gives both A and B
|
||||||
((and
|
((and
|
||||||
|
(not (eq system-type 'windows-nt))
|
||||||
(grep-probe
|
(grep-probe
|
||||||
find-program `(nil nil nil ,(null-device) "-print0"))
|
find-program `(nil nil nil ,(null-device) "-print0"))
|
||||||
(grep-probe xargs-program '(nil nil nil "-0" "echo")))
|
(grep-probe xargs-program '(nil nil nil "-0" "echo")))
|
||||||
'gnu)
|
'gnu)
|
||||||
|
;; "find -exec {} +" gives A but not B
|
||||||
|
((grep-probe find-program
|
||||||
|
`(nil nil nil ,(null-device) "-exec" "echo"
|
||||||
|
"{}" "+"))
|
||||||
|
'exec-plus)
|
||||||
|
;; "find -exec {} ;" gives neither A nor B.
|
||||||
(t
|
(t
|
||||||
'exec))))
|
'exec))))
|
||||||
(unless grep-find-command
|
(unless grep-find-command
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue