Live data from Hacker News

Ripgrep 15.0

github.com

31–40 of 119 posts

Re: Ripgrep 15.0

#31

Has it caught up to ugrep in terms of backward compatibility and speed yet?

To back up what I said earlier, a common case for ripgrep is to search a code repository while respecting gitignore, ignoring hidden files and ignoring binary files. Indeed, this is ripgrep's default mode.

For example, in my checkout of the Chromium repository, notice how much faster ripgrep is at this specific use case (with the right flags given to `ugrep` to make it ignore the same files):

    $ hyperfine --output pipe 'rg Openbox' 'ugrep-7.5.0 -rI --ignore-files Openbox ./'
    Benchmark 1: rg Openbox
      Time (mean ± σ):     281.0 ms ±   3.6 ms    [User: 1294.8 ms, System: 1977.6 ms]
      Range (min … max):   275.9 ms … 286.8 ms    10 runs

    Benchmark 2: ugrep-7.5.0 -rI --ignore-files Openbox ./
      Time (mean ± σ):      4.250 s ±  0.008 s    [User: 4.683 s, System: 2.154 s]
      Range (min … max):    4.242 s …  4.267 s    10 runs

    Summary
      rg Openbox ran
       15.12 ± 0.19 times faster than ugrep-7.5.0 -rI --ignore-files Openbox ./
`ugrep` actually does a lot better if you don't ask it to respect gitignore files:

    $ hyperfine --output pipe 'rg -u Openbox' 'ugrep-7.5.0 -rI Openbox ./'
    Benchmark 1: rg -u Openbox
      Time (mean ± σ):     233.9 ms ±   3.3 ms    [User: 650.4 ms, System: 2081.6 ms]
      Range (min … max):   228.8 ms … 239.8 ms    12 runs

    Benchmark 2: ugrep-7.5.0 -rI Openbox ./
      Time (mean ± σ):     605.4 ms ±   6.4 ms    [User: 1104.1 ms, System: 2710.8 ms]
      Range (min … max):   596.1 ms … 613.9 ms    10 runs

    Summary
      rg -u Openbox ran
        2.59 ± 0.05 times faster than ugrep-7.5.0 -rI Openbox ./
Even ripgrep runs a little faster. Because sometimes matching gitignores takes extra time. More so, it seems, in ugrep's case.

Now ugrep is perhaps intended to be more like a POSIX grep than ripgrep is. So you could question whether this is a fair comparison. But if you're going to bring up "ripgrep catching up to ugrep," then it's fair game, IMO, to compare ripgrep's default mode of operation with ugrep using the necessary flags to match that mode.

Repository info:

    $ git remote -v
    origin  git@github.com:nwjs/chromium.src (fetch)
    origin  git@github.com:nwjs/chromium.src (push)
    $ git rev-parse HEAD
    1e57811fe4583ac92d2f277837718486fbb98252

Re: Ripgrep 15.0

#32
the one thing i'd love to see added is an "extension" flag, equivalent to -g but which treats the provided arg as an extension (so `rg -e c,h` instead of `rg -g '*.{c,h}'`). 99% of the time I use glob patterns it's to match on extension.

Re: Ripgrep 15.0

#33
post #11

rg is a first for me in that it's a CLI tool that an LLM taught me about -- it's a go-to tool for Claude and codex, and since I got most of my bash skills pre-dotcom-one-boom I'm historically just a grep user. Anyway I'm trying to retrain the fingers these days, rg is super cool.

I switched to `ack` in 2017 because it handles recursive searches better. I didn't bother switching to `ag` when it came around because of having to retrain. But eventually I did switch to `rg` because it just has so many conveniences. I even switched to `fd` recently instead of `find` because it's easier and less typing for common use-cases. I've been using the terminal since 1997, so I'm happy I can still learn new…

In my case, I am still using ag because rg doesn't seem to be better enough to switch. What's the big deal with rg vs ag?

I had a similar thing with bash vs zsh before I learned about oh-my-zsh. Nushell also seems attractive these days... the good stuff from PowerShell in a POSIX-like shell.

Re: Ripgrep 15.0

#34

[flagged]

Semver advocates hijacked the very common and pre-existing format of versions specified by dot-separated numbers, and then declared a specific meaning for it.

That’s nice for people who want to use that specific meaning, but it doesn’t mean that every instance of dot-separated version numbers is “semver”, nor that everyone who chooses not to follow these rules is “doing semver wrong”.

Re: Ripgrep 15.0

#35
post #32

the one thing i'd love to see added is an "extension" flag, equivalent to -g but which treats the provided arg as an extension (so `rg -e c,h` instead of `rg -g '*.{c,h}'`). 99% of the time I use glob patterns it's to match on extension.

Have you seen the `-t/--type` flag? Your example could be written `-tc`. And for common ones that aren't in ripgrep already, you can define your own types.

Re: Ripgrep 15.0

#36
ripgrep is one of the main reasons I got interested in rust. it worked so well, it piqued my interest that it was written in rust. many years later, very glad about that. been using `rg` daily since then as well!

Re: Ripgrep 15.0

#37
post #11

Earlier quoted context omitted.

I switched to `ack` in 2017 because it handles recursive searches better. I didn't bother switching to `ag` when it came around because of having to retrain. But eventually I did switch to `rg` because it just has so many conveniences. I even switched to `fd` recently instead of `find` because it's easier and less typing for common use-cases. I've been using the terminal since 1997, so I'm happy I can still learn new…

In my case, I am still using ag because rg doesn't seem to be better enough to switch. What's the big deal with rg vs ag? I had a similar thing with bash vs zsh before I learned about oh-my-zsh. Nushell also seems attractive these days... the good stuff from PowerShell in a POSIX-like shell.

ripgrep is a lot faster (which you might only notice on larger haystacks), has many fewer bugs and is maintained.

Re: Ripgrep 15.0

#38
post #32

the one thing i'd love to see added is an "extension" flag, equivalent to -g but which treats the provided arg as an extension (so `rg -e c,h` instead of `rg -g '*.{c,h}'`). 99% of the time I use glob patterns it's to match on extension.

Have you seen the `-t/--type` flag? Your example could be written `-tc`. And for common ones that aren't in ripgrep already, you can define your own types.

I have, and it's a very neat feature :) it just feels like extra ceremony to define my own type the first time I need a custom glob, though it would probably pay off in the long run

Re: Ripgrep 15.0

#40

rg is a first for me in that it's a CLI tool that an LLM taught me about -- it's a go-to tool for Claude and codex, and since I got most of my bash skills pre-dotcom-one-boom I'm historically just a grep user. Anyway I'm trying to retrain the fingers these days, rg is super cool.

Through I use rg to initiate searches, my muscle memory keeps using grep after pipes.

Heh, I realized the same for myself the other day. I’ve been deliberately making myself go back and change it to rg to try to replace the muscle memory.
Post reply on HN