Don’t underestimate grep-based code scanning
11–20 of 122 posts
Re: Don’t underestimate grep-based code scanning
#12Earlier quoted context omitted.
Grep is really fast at that at the actual search (gnu grep at least), the gain there is mostly that "smarter" tools will ignore e.g. VCS data or binary files by default whereas grep will trawl through your PNGs and git packfiles.
Explanation from the original author on why GNU grep is fast: https://lists.freebsd.org/pipermail/freebsd-current/2010-Aug... Excerpt: "The result of this is that, in the limit, GNU grep averages fewer than 3 x86 instructions executed for each input byte it actually looks at (and it skips many bytes entirely)."
However note https://news.ycombinator.com/item?id=19522987
> It does not. ripgrep does not use Boyer-Moore in most searches.
> In particular, the advice in [the freebsd mailing list post] is generally out of date.
although the out of date bits are really the Boyer-Moore ones: https://lobste.rs/s/ycydmd
> much of Mike Haertel’s advice in this post is still good. The bits about literal scanning, avoiding searching line-by-line, and paying attention to your input handling are on the money.
> But the stuff about Boyer-Moore is outdated.
Re: Don’t underestimate grep-based code scanning
#13Re: Don’t underestimate grep-based code scanning
#14Just a small note that I would highgly recommend ripgrep[0] over standard grep. It's another modern tool that has been created by leveraging Rust and it's from BurntSushi[1] who is excellent. 0: https://github.com/BurntSushi/ripgrep 1. https://github.com/BurntSushi
It is written in Rust which isn't available on anything other than Linux, OS X and Windows.
I'll just stick to /usr/bin/find and /usr/bin/egrep programs. That works just fine without having to port Rust before trying to build a re-invention of find and egrep.
Re: Don’t underestimate grep-based code scanning
#15Just a small note that I would highgly recommend ripgrep[0] over standard grep. It's another modern tool that has been created by leveraging Rust and it's from BurntSushi[1] who is excellent. 0: https://github.com/BurntSushi/ripgrep 1. https://github.com/BurntSushi
This program re-invented find + egrep. It is written in Rust which isn't available on anything other than Linux, OS X and Windows. I'll just stick to /usr/bin/find and /usr/bin/egrep programs. That works just fine without having to port Rust before trying to build a re-invention of find and egrep.
Re: Don’t underestimate grep-based code scanning
#16Earlier quoted context omitted.
It's way faster, which is great when you're working with big repos. It's designed for recursively searching through a lot of files.
However fast it is, it's going to have a tough time beating /usr/bin/fgrep.
Re: Don’t underestimate grep-based code scanning
#17Earlier quoted context omitted.
This program re-invented find + egrep. It is written in Rust which isn't available on anything other than Linux, OS X and Windows. I'll just stick to /usr/bin/find and /usr/bin/egrep programs. That works just fine without having to port Rust before trying to build a re-invention of find and egrep.
It "reinvented" it and made it dramatically faster. Rust is also available on FreeBSD. I don't think you actually need Rust to run ripgrep. It's not like it's an interpreted language.
Dramatically faster? Is there any scientific evidence to that?
If it were me, I wouldn't rush to make assumptions.
Re: Don’t underestimate grep-based code scanning
#18Re: Don’t underestimate grep-based code scanning
#19Still never going to beat AST-integrated searching like VS has for C#. Which has a regex search too.
Re: Don’t underestimate grep-based code scanning
#20Earlier quoted context omitted.
It "reinvented" it and made it dramatically faster. Rust is also available on FreeBSD. I don't think you actually need Rust to run ripgrep. It's not like it's an interpreted language.
Since when do FreeBSD executables run on the illumos family of operating systems, as far as I know, there is no freebsd-branded zone yet in illumos? Dramatically faster? Is there any scientific evidence to that? If it were me, I wouldn't rush to make assumptions.
I also never said anything about Illumos.