tavianator/bfs

Optimize -path foo -o -path bar expressions

catern opened this issue · 2 comments

catern commented

bfs, like GNU find (see https://savannah.gnu.org/bugs/index.php?58197 ) does not optimize -path foo -o -path bar expressions. As far as I can tell, it just checks each -path operand linearly. As you can see in the linked bug, this causes slowdowns for some common find use-cases, including ones in GNU Emacs.

Could you consider optimizing this?

Oof that is quite the expression tree. I'm not opposed to optimizing this kind of thing, but it's likely to be kinda hard.

For the record, special-casing -path '*.foo' to use strcmp() instead of fnmatch() speeds up that command line by 3.6x.