Thank you for the feedback! Most of the credit for the speed goes to the amazing Rust modules 'ignore' and 'regex', which are also used by ripgrep (https://github.com/BurntSushi/ripgrep).
Did you do a benchmark with `--threads 1`? I suspect most of the speedup is coming from that as the the listing of the files is likely to be IO bound (or at least bound by calling into the kernel to read the directory listings).
That has certainly been my experience in the past when experimenting with this sort of thing, that more threads makes a lot of difference.
I did. You are right, multi-threading does not give a linear speed up, but it makes fd about a factor of three faster on my machine (8 virtual cores). With `--threads 1`, fd is on-par with 'find -iname', but still faster than 'find -iregex'.
fd is about a factor of 2-3 faster (for this example):
> time fd -HIe jpg > /dev/null
5,12s user 2,03s system 785% cpu 0,911 total
> time ag --depth 100 -uuu -g '\.jpg$' > /dev/null
0,95s user 1,66s system 99% cpu 2,628 total
I've found that fzf has replaced all uses of find for me except in scripts. fzf has the benefits of being bound to a single key binding and showing me results as I type, rather than after the command runs.
fzf is fine for searching just for filenames, but it does nothing else that find does.
It can't even search specifically for directories, as far as I can see, nevermind searching for files/dirs with certain permissions, ages, etc. It's also uselesss for non-interactive uses such as scripting. I like fzf, but it's really not anywhere close to a complete find replacement.
You're right that fzf doesn't replace find. Fzf is just an interactive, filtering tool. You can pipe anything into it. find is a common way of populating it with data.
I suspect the GP meant that fzf replaced the pattern 'find |xargs $binary' for small interactive use cases. It's much nicer to do '$binary '. I use fzf the same way with key bindings to select directories and files powered by find.
fzf just actually calls find by default, so a naked call to fzf will actually give you the same results as find | fzf. Search specifically for directories, that's find -type d | fzf.
Interesting. Why does multithreading make a big difference? I would have assumed that disk seek latency was the speed-limiting factor; what am I missing?
Should have been more clear heh. There was a benchmark that didn't use regex and seemed to turn off the ignore files feature. Im not familiar with rust or those crates Im assuming that's what those are there for?
Comments (215) 23 threads
Earlier commentsThat has certainly been my experience in the past when experimenting with this sort of thing, that more threads makes a lot of difference.
I did. You are right, multi-threading does not give a linear speed up, but it makes fd about a factor of three faster on my machine (8 virtual cores). With `--threads 1`, fd is on-par with 'find -iname', but still faster than 'find -iregex'.
rg -g '*.foo' --files
The mysql-server repository[1] should be a fun one to try out, because of this:
The combination of fast glob matching[2] and parallel traversal should be a boon.[1] - https://github.com/mysql/mysql-server
[2] - https://github.com/BurntSushi/ripgrep/blob/e7c06b92fb996adcb...
It can't even search specifically for directories, as far as I can see, nevermind searching for files/dirs with certain permissions, ages, etc.
It's also uselesss for non-interactive uses such as scripting.
I like fzf, but it's really not anywhere close to a complete find replacement.
I suspect the GP meant that fzf replaced the pattern 'find |xargs $binary' for small interactive use cases. It's much nicer to do '$binary '. I use fzf the same way with key bindings to select directories and files powered by find.
fzf just actually calls find by default, so a naked call to fzf will actually give you the same results as find | fzf.
Search specifically for directories, that's find -type d | fzf.
Continue this thread — 1 reply
All comments shown.
Couldn't load more comments. Check your connection and try again.