I can't think of a single time I've used grep where I thought "I wish this was faster".
Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
31–40 of 198 posts
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#32Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#33I can't think of a single time I've used grep where I thought "I wish this was faster".
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#34I switched from from ripgrep to ugrep and never looked back. It's just as fast, but also comes with fuzzy matching (which is super useful), a TUI (useful for code reviews), and can also search in PDFs, archives, etc. The optional Google search syntax also very convenient. https://ugrep.com
Ugrep has that. In my case, I’m working with zipped corpora of millions of small text files, so I can skip unpacking the whole thing to the filesystem (certain filesystems have trouble at this scale).
I’m grateful for both tools. Thanks to the respective authors!
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#35But is any of them using `_mm256_sad_epu8` for small, literal strings?
Not exactly but yes, it ultimately uses the `memchr` crate [1] which provides SIMD-optimized character and string search routines. But it uses `_mm256_cmpeq_epi8` instead of `_mm256_sad_epu8`. [1] https://docs.rs/memchr/latest/memchr/
https://github.com/BurntSushi/aho-corasick/blob/f227162f7c56...
But no `_mm256_sad_epu8`. What an oddly specific question..?
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#36 (add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
The Xref key sequences and commands work fine with it. If I type M-. (or C-u M-.) to find definitions of an identifier in a Python project, dumb-jump runs a command like the following, processes the results, and displays the results in an Xref buffer. rg --color never --no-heading --line-number -U --pcre2 --type py '\s*\bfoo\s*=[^=\n]+|def\s*foo\b\s*\(|class\s*foo\b\s*\(?' /path/to/git/project/
The above command shows how dumb-jump automatically restricts the search to the current file type within the current project directory. If no project directory is found, it defaults to the home directory.By the way, dumb-jump supports the silver searcher tool ag too which happens to be quite fast as well. If neither ag nor rg is found, it defaults to grep which as one would expect can be quite slow while searching the whole home directory.
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#37I can't think of a single time I've used grep where I thought "I wish this was faster".
From my perspective it's a no brainer. I don't HAVE a grep (because I don't have a Unix) so when I install a grep, any grep, reaching for rg is natural. It's modern and maintained. I have no scripts anywhere that might expect grep to be called "grep".
Of course if you already have a grep (e.g. you run Unix/Linux) then the story is different. Your system probably already has a grep. Replacing it takes effort and that effort needs to have some return.
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#38Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#39I use ripgrep with the Emacs packages project.el (comes out of the box) and dumb-jump (needs to be installed). This may not be the most popular way of using rg but I have been very pleased with the overall experience. All it takes is running package-install to install the dumb-jump package and configuring the following hook: (add-hook 'xref-backend-functions #'dumb-jump-xref-activate) The Xref key sequences and comma…
Ripgrep can be used quite easily with the project.el package too that comes out of the box in Emacs. So it is not really necessary to install an external package to make use of ripgrep within Emacs. We first need to configure xref-search-program to ripgrep as shown below, otherwise it defaults to grep which can be quite slow on large directories:
(setq xref-search-program 'ripgrep)
Then a project search with C-x p g foo RET ends up executing a command like the following on the current project directory: rg -i --null -nH --no-heading --no-messages -g '!*/' -e foo
The results are displayed in an Xref buffer again which in my opinion is the best thing about using external search tools within Emacs. The Xref key sequences like n (next match), p (previous match), RET (jump to source of match), C-o (show the source of the match in a split window), etc. make navigating the results a breeze!Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#40What are the reasons for grep not being replaced/improved? This topic seems a bit old by now.
Sounds like that could introduce a ton of breakage, for little value. People who want a faster grep will use a different thing, while people who use grep can continue to use it. Sounds like an ideal situation already.