Live data from Hacker News

Show HN: A simple, fast and user-friendly alternative to find, written in Rust

github.com

21–30 of 225 posts

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#21
post #17

It would be nice to have a collection of modern/faster/saner alternatives to common unix tools and such utilities (made in rust or not) that becomes standard -- or at least easily installable in linux distros and OS X. Not for replacing those tools, but for supplementing them. Thinking of stuff like fd and: ripgrep: https://github.com/BurntSushi/ripgrep (grep/ag alt) xsv: https://github.com/BurntSushi/xsv (csv tool)…

[deleted]

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#22
post #11
post #4

My main usecase for find is not only finding files, but to do actions on them through -exec. Unless I’m missing something, that’s not supported with this tool.

You can easily compose this with `xargs` using the`-0 / --print0` option: fd -0 '\.log$' | xargs -0 tail

xargs does have limits on input length. On some platforms they aren't terribly high. Sound like -exec is potentially coming though.

Edit: Swore I had gotten ARG_MAX complaints out of xargs in the past. Replies are correct though. I'm wrong here...xargs adjusts on the fly. Perhaps long ago, or some obscure use of xargs?

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#24

How does it compare in speed to 'ag' (i.e the silver searcher) -g option?

I haven't benchmarked them, but fd has a recursive parallel directory iterator. ag doesn't.

The mysql-server repository[1] should be a fun one to try out, because of this:

    $ wc -l .gitignore
    3122 .gitignore
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...

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#25
post #10

It is incredibly fast! Thanks a lot for this great tool!

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.

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#26
post #22
post #11

Earlier quoted context omitted.

You can easily compose this with `xargs` using the`-0 / --print0` option: fd -0 '\.log$' | xargs -0 tail

xargs does have limits on input length. On some platforms they aren't terribly high. Sound like -exec is potentially coming though. Edit: Swore I had gotten ARG_MAX complaints out of xargs in the past. Replies are correct though. I'm wrong here...xargs adjusts on the fly. Perhaps long ago, or some obscure use of xargs?

> xargs does have limits on input length

what?

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#27
post #23
post #14

Why is this faster then find?

"Concerning fd's speed, the main credit goes to the regex and ignore crates that are also used in ripgrep"

Yes. For simple searches, the main reason is that 'fd' walks the directory tree in a multithreaded fashion (thanks to the 'ignore' crate).

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#28
post #4

My main usecase for find is not only finding files, but to do actions on them through -exec. Unless I’m missing something, that’s not supported with this tool.

I'm curious why you (or anyone) uses -exec? It's often painfully slower than piping through xargs and I find the syntax (the semicolon and braces and the required quoting/escaping) uncomfortable. I haven't used -exec in 20 years.

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#29
post #22
post #11

Earlier quoted context omitted.

You can easily compose this with `xargs` using the`-0 / --print0` option: fd -0 '\.log$' | xargs -0 tail

xargs does have limits on input length. On some platforms they aren't terribly high. Sound like -exec is potentially coming though. Edit: Swore I had gotten ARG_MAX complaints out of xargs in the past. Replies are correct though. I'm wrong here...xargs adjusts on the fly. Perhaps long ago, or some obscure use of xargs?

Why is this a problem? Except in terms of performance, it's completely invisible to the user as xargs will run the command multiple times to ensure all the arguments are processed. In the most extreme/unrealistic case, if xargs could only support invoking the command with a single arguement, then the performance would regress to that of using -exec. Otherwise it's much faster.

Re: Show HN: A simple, fast and user-friendly alternative to find, written in Rust

#30
post #26
post #22

Earlier quoted context omitted.

xargs does have limits on input length. On some platforms they aren't terribly high. Sound like -exec is potentially coming though. Edit: Swore I had gotten ARG_MAX complaints out of xargs in the past. Replies are correct though. I'm wrong here...xargs adjusts on the fly. Perhaps long ago, or some obscure use of xargs?

> xargs does have limits on input length what?

Yeah they can be as low as 4096 bytes. `xargs --show-limits`
Post reply on HN