Live data from Hacker News

Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

blog.burntsushi.net

11–20 of 198 posts

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#11
post #5

git grep cannot even find a simple string in its repo.

I don’t think there’s been a point to using `git grep` since ack started parsing gitignore. As far as I’m concerned the use case of `git grep` is to search into non-checked-out trees (by giving it a tree-ish). And it’s not super great at that, because it searches a static tree-ish, so pickaxe filters are generally more useful (though they’re slow).

Once again mercurial has/had more useful defaults, `hg grep` searches through the history by default, that’s it’s job.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#12
post #3

It's fast indeed. And I can't help keeping promoting the combination with fzf :) For those who want to try it out, this is a Powershell function but the same principle applies in any shell. Does ripgrep then puts fuzzy searching in the resulting files+text on top while showing context in bat: function frg { $result = rg --ignore-case --color=always --line-number --no-heading @Args | fzf --ansi ` --color 'hl:-1:underl…

Infact I would recommend a step further to integrate rip-grep-all (rga) with fzf that can do a fuzzy search not just on text files but on all types of files including pdfs, zip files. More details here [1]

[1] https://github.com/phiresky/ripgrep-all/wiki/fzf-Integration

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#13
I 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

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#15
post #9
post #5

git grep cannot even find a simple string in its repo.

What? Git grep is all you ever need in my experience, and it's ~faster than~ (edit: as fast as) ripgrep when searching a git repo.

> it's faster than ripgrep when searching a git repo.

Source? Ripgrep's benchmarks show it significantly faster.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#16
post #10

[flagged]

So? My distro doesn't come with almost any of the tools I need for day to day work. It has never been a problem for me to install a new editor or compiler on a new machine, I don't see why ripgrep would be any different. Especially since it's usually a single command to install anyway.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#18
post #3

It's fast indeed. And I can't help keeping promoting the combination with fzf :) For those who want to try it out, this is a Powershell function but the same principle applies in any shell. Does ripgrep then puts fuzzy searching in the resulting files+text on top while showing context in bat: function frg { $result = rg --ignore-case --color=always --line-number --no-heading @Args | fzf --ansi ` --color 'hl:-1:underl…

Not bad. For those who want to try it, install all prereqs with: choco install fzf bat ripgrep How do you scroll the preview window with keyboard ?

shift-up/down

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#19
post #3

It's fast indeed. And I can't help keeping promoting the combination with fzf :) For those who want to try it out, this is a Powershell function but the same principle applies in any shell. Does ripgrep then puts fuzzy searching in the resulting files+text on top while showing context in bat: function frg { $result = rg --ignore-case --color=always --line-number --no-heading @Args | fzf --ansi ` --color 'hl:-1:underl…

Not bad. For those who want to try it, install all prereqs with: choco install fzf bat ripgrep How do you scroll the preview window with keyboard ?

> How do you scroll the preview window with keyboard ?

    alias pf="fzf --preview='less {}' --bind shift-up:preview-page-up,shift-down:preview-page-down"
That will let you run `pf` to preview files in less and lets you use shift + arrow keys to scroll the preview window. No dependencies are needed except for fzf. If you want to use ripgrep with fzf you can set FZF_DEFAULT_COMMAND to run rg such as `export FZF_DEFAULT_COMMAND="rg ..."` where ... are your preferred rg flags. This full setup is in my dotfiles at https://github.com/nickjj/dotfiles.

I've made a video and blog post about it here: https://nickjanetakis.com/blog/customize-fzf-ctrl-t-binding-...

I also made https://nickjanetakis.com/blog/using-fzf-to-preview-text-fil... which covers how to modify fzf's built in CTRL+t shortcut to allow for previews too. CTRL+t is a hotkey driven way to fuzzy match a list of files.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#20
post #2

The title needs “(2016)”. This is the original announcement, not new information.

Discussions:

"Ripgrep – A new command line search tool" https://news.ycombinator.com/item?id=12564442 (740 points | Sept 23, 2016 | 209 comments) - there are discussions related to speed too

"Ripgrep is faster (2016)" https://news.ycombinator.com/item?id=17941319 (98 points | Sept 8, 2018 | 40 comments)

Post reply on HN