Earlier quoted context omitted.
I wrote a bash version of this: function frg { result=`rg --ignore-case --color=always --line-number --no-heading "$@" | fzf --ansi \ --color 'hl:-1:underline,hl+:-1:underline:reverse' \ --delimiter ':' \ --preview "bat --color=always {1} --theme='Solarized (light)' --highlight-line {2}" \ --preview-window 'up,60%,border-bottom,+{2}+3/3,~3'` file="${result%%:*}" linenumber=`echo "${result}" | cut -d: -f2` if [ ! -z "…
I've never really seen PowerShell beyond minimal commands, but after seeing the parent, I definitely think it has the superior syntax of the shells. Especially for scripts.
Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
111–120 of 198 posts
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#112Earlier quoted context omitted.
I wrote a bash version of this: function frg { result=`rg --ignore-case --color=always --line-number --no-heading "$@" | fzf --ansi \ --color 'hl:-1:underline,hl+:-1:underline:reverse' \ --delimiter ':' \ --preview "bat --color=always {1} --theme='Solarized (light)' --highlight-line {2}" \ --preview-window 'up,60%,border-bottom,+{2}+3/3,~3'` file="${result%%:*}" linenumber=`echo "${result}" | cut -d: -f2` if [ ! -z "…
I've never really seen PowerShell beyond minimal commands, but after seeing the parent, I definitely think it has the superior syntax of the shells. Especially for scripts.
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#113Earlier quoted context omitted.
I guess it is because after decades of use, grep has probably been fixed to handle lots of user cases that the new tools don´t handle because they haven´t found them yet.
Author of ripgrep here. Like automatic encoding detection and transparently searching UTF-16? Or simple ways for composing character classes, e.g., `[\pL&&\p{Greek}]` for all codepoints in the Greek script that are letters. Another favorite of mine is `\P{ascii}`, which will search for any codepoint that isn't in the ASCII subset. Or more sophisticated filtering features that let you automatically respect things like…
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#114Earlier quoted context omitted.
I've never really seen PowerShell beyond minimal commands, but after seeing the parent, I definitely think it has the superior syntax of the shells. Especially for scripts.
Maybe if the "popular" shells, but http://www.nushell.sh/ is looking better and better
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#115Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#116Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#117I 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
So I was casually searching for "ugrep vs ripgrep" articles, when I stumbled upon a couple reddit posts where apparently the authors of ugrep and ripgrep seemed to have a multi-year feud on reddit, eg. https://www.reddit.com/r/programming/comments/120wqvr/ripgre... So weird. I mean, it's just about some open source tool, right? :-/
‡ The main commercial product of the ugrep author's company at the time was the gSOAP code generator (it may still be), and that it not only works but makes a reasonably good C and C++ API from WSDL is proof that it is the product of a genius madman. It also allowed you to create both the API and WSDL from a C++-ish header, and both .NET and Java WSDL tools worked perfectly with it. We needed it to work and work it did.
At the time, the generated API was just difficult enough to use that I generated another ~1k lines of code for that project. IIRC, the generated API is sort of handle-based, which requires a slightly different approach than the strict RAII approach we were using. Generating that code was a minor adventure (generating the gSOAP code from the header-ish file, generating doxygen XML from the generated gSOAP code, then generating the wrapper C++ from the doxygen XML).
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#118What are the reasons for grep not being replaced/improved? This topic seems a bit old by now.
grep is a general purpose tool for searching for text in all types of files, baked into the standards for UNIX. Some programmers use it to search source code. Other people use it for other types of text searches that have nothing to do with source code, they rely on it in scripts, they don't use it as part of a text-based programmer UI, they rely on it to never crash, etc. ripgrep is a specialist, opinionated tool, d…
I was under the impression that grep removed mmap() support because it was slower than normal file i/o
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#119What are the reasons for grep not being replaced/improved? This topic seems a bit old by now.
grep is a general purpose tool for searching for text in all types of files, baked into the standards for UNIX. Some programmers use it to search source code. Other people use it for other types of text searches that have nothing to do with source code, they rely on it in scripts, they don't use it as part of a text-based programmer UI, they rely on it to never crash, etc. ripgrep is a specialist, opinionated tool, d…
Oh I beg to differ! The blog post goes into this. Here's a simple demonstration using ripgrep 14:
$ ls -l full.txt
-rw-rw-r-- 1 andrew users 13113340782 Sep 29 12:30 full.txt
$ time rg -c --no-mmap 'Clipton' full.txt
294
real 1.419
user 0.539
sys 0.879
maxmem 15 MB
faults 0
$ time LC_ALL=C grep -c 'Clipton' full.txt
294
real 6.911
user 6.078
sys 0.829
maxmem 15 MB
faults 0
$ time rg -c --no-mmap 'DMZ|Clipton' full.txt
1070
real 1.643
user 0.747
sys 0.894
maxmem 15 MB
faults 0
$ time LC_ALL=C grep -E -c 'DMZ|Clipton' full.txt
1070
real 8.317
user 7.384
sys 0.930
maxmem 15 MB
faults 0
No memory maps. No multi-threading. No filtering. No fancy regex engine features or reducing expressiveness. No locales. No UTF-8. No UTF-16. Just a simple literal and a simple alternation of literals. It's just better algorithms.Also, you can disable ripgrep's opinions with `-uuu`. It's not designed to just be for code searching. You can use it for normal grepping too. It will even automatically revert to the standard grep line format in shell pipelines.
Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)
#120Earlier quoted context omitted.
grep is a general purpose tool for searching for text in all types of files, baked into the standards for UNIX. Some programmers use it to search source code. Other people use it for other types of text searches that have nothing to do with source code, they rely on it in scripts, they don't use it as part of a text-based programmer UI, they rely on it to never crash, etc. ripgrep is a specialist, opinionated tool, d…
> you can make it use mmap() at the risk of it crashing on truncated files I was under the impression that grep removed mmap() support because it was slower than normal file i/o
$ ls -l full.txt
-rw-rw-r-- 1 andrew users 13113340782 Sep 29 12:30 full.txt
$ time rg -c --no-mmap Clipton full.txt
294
real 1.337
user 0.470
sys 0.866
maxmem 15 MB
faults 0
$ time rg -c --mmap Clipton full.txt
294
real 1.045
user 0.722
sys 0.323
maxmem 12511 MB
faults 0
But in recursive search, especially when used for lots of little files, they end up provoking substantial overhead that slows everything down.And this might change depending on the platform.