Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> It performs amazing even in a larger code base.

Doubt ripgrep it will beat indexing, line GNU id-utils. (mkid to build ID file, lid to query).

If you're using git, "git grep" is useful; it searches only files indexed in git, which provides a useful speedup.




> Doubt ripgrep it will beat indexing, line GNU id-utils. (mkid to build ID file, lid to query).

Does it provide the same user experience? i.e., Does it keep the index up to date for you automatically? If so, that's something a lot of users aren't willing to pay for.

If you want a pre-indexed solution, I'd recommend checking out qgrep instead: https://zeux.io/2019/04/20/qgrep-internals/

> If you're using git, "git grep" is useful; it searches only files indexed in git, which provides a useful speedup.

Depends on what you're searching. In a checkout of the Linux kernel:

    $ time LC_ALL=C git grep -E '[A-Z]+_SUSPEND' | wc -l
    3707

    real    1.033
    user    5.769
    sys     0.592
    maxmem  63 MB
    faults  0

    real    1.033
    user    0.000
    sys     0.008
    maxmem  9 MB
    faults  0

    $ time LC_ALL=en_US.UTF-8 git grep -E '[A-Z]+_SUSPEND' | wc -l
    3707

    real    3.624
    user    21.910
    sys     0.404
    maxmem  64 MB
    faults  0

    real    3.623
    user    0.000
    sys     0.008
    maxmem  9 MB
    faults  0

    $ time rg '[A-Z]+_SUSPEND' | wc -l
    3707

    real    0.138
    user    0.767
    sys     0.704
    maxmem  21 MB
    faults  0

    real    0.138
    user    0.003
    sys     0.006
    maxmem  9 MB
    faults  0
This is even despite the fact that `git grep` already has a file index (ripgrep has to process the >200 `.gitignore` files in the Linux repo for every search) and the fact that `git grep` is also using parallelism.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: