bug#81525: 32.0.50; [PATCH] Performance improvement for rgrep's find command
Manuel Giraud <[email protected]> Fri, 31 Jul 2026 17:06:44 +0200
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Phil Sainty <[email protected]> writes: > On 2026-07-31 20:13, Manuel Giraud wrote: >> Thanks. I have used your benchmark and FWIW, I don't see much >> difference on a OpenBSD machine: > > Interesting. Perhaps your version of find figures out that > it can use more efficient matching in these cases (or just > has a faster implementation of the -path matching). Your interrogations drive me into more tests ;-) So yes, OpenBSD has its own implementation of find but there is also a package with GNU find (renamed gfind). The version of GNU find, I have is: find (GNU findutils) 4.10.0 Copyright (C) 2024 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Eric B. Decker, James Youngman, and Kevin Dalley. Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=1) Now, I have run your benchmark again like this: (require 'grep) (grep-compute-defaults) (with-current-buffer (get-buffer-create "*result*") (erase-buffer) (dolist (find (list "find" "gfind")) (let ((grep-find-template (format "time %s -H <D> <X> -type f <F> -print 2>/dev/null" find))) (dotimes (i 2) (shell-command (rgrep-default-command "ignore" "no-such-file" "$HOME")) (insert (format "%s#%d\n" find i)) (insert-buffer-substring "*Shell Command Output*"))))) And here is the results, I get: * Without your patch: find#0 0m30.76s real 0m03.45s user 0m15.64s system find#1 0m09.03s real 0m01.34s user 0m07.72s system gfind#0 0m02.25s real 0m01.33s user 0m00.91s system gfind#1 0m02.25s real 0m01.19s user 0m01.05s system * With your patch: find#0 0m29.81s real 0m03.43s user 0m15.36s system find#1 0m08.93s real 0m01.52s user 0m07.32s system gfind#0 0m02.33s real 0m01.33s user 0m00.97s system gfind#1 0m02.25s real 0m01.23s user 0m01.05s system Each run was done after a fresh reboot (I don't know how to flush the buffer cache on OpenBSD :-/) so I think that each time the first run with "find" is slower because of buffer cache's warming. What I conclude from these results: - GNU find is faster than native find. - I still don't see any significant speed up with your patch (sorry). -- Manuel Giraud