
Ripgrep 0.10.0 released (PCRE2 and multi-line support) - burntsushi
https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0
======
danso
`ack` has been my goto for grep-likes -- though I would occasionally `ag` for
the multi-line support, which ack does not have. My favorite feature of ack
that ag didn't have was the --output flag, which would let you do something
like this:

    
    
         $ 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.

~~~
icc97
You can use ripgrep with Ack. We'll at least you can with Vim [0], so I assume
it works outside Vim too.

[0]: [https://github.com/mileszs/ack.vim](https://github.com/mileszs/ack.vim)

------
anyfoo
I've been using ag, the silver searcher, for a few years now. It's blazingly
fast (easily searching a massive code base in single-digit seconds),
automatically ignores files I almost never want to be searched (anything in
.git for example), and has convenient defaults around color highlighting and
showing context.

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.

~~~
burntsushi
ripgrep does everything you say about ag, and has much less buggy support for
gitignore. It is also quite a bit faster for bigger workloads. For smaller
work loads you might not notice a difference. However, ripgrep is good enough
to even replace uses of grep where ag might otherwise behave sub-optimally.

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. :)

~~~
dfabulich
It'd be great if you'd go back and update your blog post
[https://blog.burntsushi.net/ripgrep/](https://blog.burntsushi.net/ripgrep/)
now that so many of the "anti-pitch" bullets are fixed (and I can only assume
that the numbers have changed in the last two years)

~~~
burntsushi
Yeah, I have been superficially updating that post, but haven't yet for the
latest release.

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.

------
staticassertion
One of the first things i install on a new system. I gave it to a friend who's
just learning to program and has a hard time organizing their projects still -
it's been an absolute lifesaver.

------
eridius
Looks great!

I'm curious what the performance implications of switching to PCRE2 are.

~~~
burntsushi
PCRE2 is opt-in.

For performance, here's a start. :)
[https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#pcr...](https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#pcre2-slow)

~~~
dagenix
My extremely unscientific test had PCRE2 being quite a bit slower - 1 second
vs 0.2 seconds to search through 10k files - ie, slower, but still pretty darn
fast.

~~~
burntsushi
That feels like it's in about the right ballpark based on my own tests. You
can make it go a bit faster if you're using nightly Rust and compile with SIMD
optimizations:

    
    
        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. :-)

~~~
dagenix
I installed with:

    
    
        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!

------
nothrows
sticking with ack. a tool for humans with decent .ignore file support. ag and
rg never seem to ignore the subdirectories I want.

~~~
burntsushi
Can you give a specific example? I'd be happy to try and work though it with
you! ripgrep certainly supports .ignore files. Last I checked, ack
specifically doesn't support .ignore files: [https://beyondgrep.com/feature-
comparison/](https://beyondgrep.com/feature-comparison/)

