Ripgrep 0.10.0 released (PCRE2 and multi-line support)
github.com
github.com
$ ack '^(\w+)' --output 'hello $1 world'
hello abc world
hello defgh world
hello etc world
But seems like this is equivalent to rg's `-or` flag, so looks like I don't have any reason to not switch over. I love the `-r` flag by itself (short for `--replace`), which seems like a handy replacement for sed's substitution. Also, I've been impressed with how responsive and receptive the author has been on Github.And it doesn't hurt that all of other burntsushi's tools seem solid and well-designed, such as xsv.
I'm more than open to add ripgrep to my collection of everyday tools, however, if there is a real benefit. Does ripgrep do anything that would replace or complement my ag usage?
Note that it may also be possible that for new users, ripgrep is the better tool, but that ag is still more than good enough if you already based workflows and habits around it.
Specifically, with this release, ag no longer has any major features that ripgrep doesn't have. Additionally, ripgrep gives you almost every flag found in GNU grep, and then some.
I think some of this is addressed in the README. :)
Updating the benchmarks is harder because of the analysis. I would need to redo almost all of it, which took weeks. The TL;DR though is that ripgrep is faster than it was then. Other tools like ag and grep have roughly remained the same.
> My hope is that this article not only convinced you that rg is quite fast, but more importantly, that you found my analysis of each benchmark educational. String searching is an old problem in computer science, but there is still plenty of work left to do to advance the state of the art.
My reflexes are still to type ag but I already want to switch to rg.
Plus, I like the regular updates and that you can also use parts of it (regex engine etc) as libraries for your own Rust programs.
I'm curious what the performance implications of switching to PCRE2 are.
For performance, here's a start. :) https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#pcr...
RUSTFLAGS="-C target-cpu=native" cargo build --release --features 'simd-accel avx-accel pcre2'
In particular, this enables SIMD optimizations in the crate ripgrep uses for decoding UTF-8, which is required to run on all files in order to use PCRE2 in Unicode mode.(Eventually, I'm hoping the SIMD optimizations in the encoding_rs crate move to using runtime detection like the regex crate instead of requiring compile time flags.)
Or alternatively, disable Unicode with `--no-pcre2-unicode` and no transcoding will be done. :-)
PCRE2_SYS_STATIC=1 RUSTFLAGS="-C target-cpu=native" rustup run nightly cargo install ripgrep --force --features 'simd-accel avx-accel pcre2'
`--no-pcre2-unicode` sped it up a little. But, it was already quite fast.Great work on ripgrep and thanks for such an amazing tool!