With respect to compatibility, see my FAQ on the topic: https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#pos...
Sounds like that could introduce a ton of breakage, for little value. People who want a faster grep will use a different thing, while people who use grep can continue to use it. Sounds like an ideal situation already.
ripgrep is a specialist, opinionated tool, designed primarily to search through source code repositories.
There's not much you can add to general purpose text search to make it faster; you can make it use mmap() at the risk of it crashing on truncated files, you can reduce the expressiveness of regular expressions so they can be computed faster. You could throw out general support for all locales and charsets and hardcode support for only UTF-8 / UTF-16, but you shouldn't.
Oh I beg to differ! The blog post goes into this. Here's a simple demonstration using ripgrep 14:
$ ls -l full.txt
-rw-rw-r-- 1 andrew users 13113340782 Sep 29 12:30 full.txt
$ time rg -c --no-mmap 'Clipton' full.txt
294
real 1.419
user 0.539
sys 0.879
maxmem 15 MB
faults 0
$ time LC_ALL=C grep -c 'Clipton' full.txt
294
real 6.911
user 6.078
sys 0.829
maxmem 15 MB
faults 0
$ time rg -c --no-mmap 'DMZ|Clipton' full.txt
1070
real 1.643
user 0.747
sys 0.894
maxmem 15 MB
faults 0
$ time LC_ALL=C grep -E -c 'DMZ|Clipton' full.txt
1070
real 8.317
user 7.384
sys 0.930
maxmem 15 MB
faults 0
No memory maps. No multi-threading. No filtering. No fancy regex engine features or reducing expressiveness. No locales. No UTF-8. No UTF-16. Just a simple literal and a simple alternation of literals. It's just better algorithms.Also, you can disable ripgrep's opinions with `-uuu`. It's not designed to just be for code searching. You can use it for normal grepping too. It will even automatically revert to the standard grep line format in shell pipelines.
I was under the impression that grep removed mmap() support because it was slower than normal file i/o
$ ls -l full.txt
-rw-rw-r-- 1 andrew users 13113340782 Sep 29 12:30 full.txt
$ time rg -c --no-mmap Clipton full.txt
294
real 1.337
user 0.470
sys 0.866
maxmem 15 MB
faults 0
$ time rg -c --mmap Clipton full.txt
294
real 1.045
user 0.722
sys 0.323
maxmem 12511 MB
faults 0
But in recursive search, especially when used for lots of little files, they end up provoking substantial overhead that slows everything down.And this might change depending on the platform.
My entirely anecdotal and unscientific impression is that rg and grep perform similarly on Linux (though rg has nicer defaults for searching through source code). The old version of grep that Apple preinstalls on the Mac was slower last time I checked though.
Like automatic encoding detection and transparently searching UTF-16?
Or simple ways for composing character classes, e.g., `[\pL&&\p{Greek}]` for all codepoints in the Greek script that are letters. Another favorite of mine is `\P{ascii}`, which will search for any codepoint that isn't in the ASCII subset.
Or more sophisticated filtering features that let you automatically respect things like gitignore rules.
Those are all things that ripgrep does that grep does not. So I do not favor this explanation personally.
ripgrep has just about all of the functionality that GNU grep does. I would say the two biggest missing pieces at this point are:
* POSIX locale support. (But this might be a feature[1].)
* Support for "basic" regexes or some equivalent that flips the escaping rules around. i.e., You need to write `\+` to match 1 or more things, where as `+` will just match `+ literally.
Otherwise, ripgrep has unfortunately grown just about as many flags as GNU grep.
[1]: https://github.com/mpv-player/mpv/commit/1e70e82baa9193f6f02...
If you want to innovate in this space, why sign up for all that? Invent a better wheel, and if people like it, they'll migrate over time.
I remember using ag in the old days, and I use rg now. But there's things rg does by default that I don't like at times... so I go back to old fashioned grep.
rg is at the point where many programmers use it. I think it is on its way to becoming one of those "standard tools". It needs... another 5 years?
When POSIX has a rg standard... we'll know ripgrep "succeeded" and teargrep will soon come into existence ;)
> so I go back to old fashioned grep
If you do `rg -uuu` then it should search the same stuff grep will. Not sure if that's what you meant though.