Hacker News new | past | comments | ask | show | jobs | submit login

> ripgrep is noticeably faster than ag.

Since both are instant on every codebase I care about, not so sure about that. These tools were always chiefly I/O bound , SSDs have torn that down especially now.

But for features: there's no lookaround in the regex.




They are only I/O bound when searching data that isn't in cache. It's often the case that you're searching, for example, a repository of code repeatedly.

> Since both are instant on every codebase I care about, not so sure about that.

It is very possible that there is no performance difference between ripgrep and ag for your use cases, but that does not mean there isn't a performance difference between ripgrep and ag. For example, in my checkout of the chromium repository:

    $ time rg -c Openbox
    testing/xvfb.py:2
    tools/metrics/histograms/enums.xml:1
    ui/base/x/x11_util.cc:1

    real    0.448
    user    2.593
    sys     2.490
    maxmem  77 MB
    faults  0

    $ time ag -c Openbox
    ui/base/x/x11_util.cc:1
    tools/metrics/histograms/enums.xml:1
    testing/xvfb.py:2

    real    2.302
    user    2.996
    sys     10.462
    maxmem  15 MB
    faults  0
> But for features: there's no lookaround in the regex.

That's not true and hasn't been true for a long time. ripgrep supports PCRE2 with the -P/--pcre2 flag. You can even put `--engine auto` in an alias or ripgreprc file and have ripgrep automatically select the regex engine based on whether you're using "fancy" features or not.

In general, I also claim that ripgrep has far fewer bugs than ag. ag doesn't really get gitignore support correct, although if you only have simple gitignores, its support might be good enough.


These tools are I/o bound, but not disk bound. I often perform multiple searches in a row, and all but the first will hit the disk cache.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: