Live data from Hacker News

App::Rak – 21st century grep / find / ack / ag / rg on steroids

github.com

41–50 of 98 posts

Re: App::Rak – 21st century grep / find / ack / ag / rg on steroids

#41
post #36
post #20

Earlier quoted context omitted.

BurntSushi (dev) built a grep replacement, `rg` (ripgrep), in Rust, that tends to run circles in terms of speed around grep itself and other grep replacements. The UX is also pretty nice. I install it everywhere now. I'm curious (like others here) how `rak` is better than `rg`. https://github.com/BurntSushi/ripgrep

It is "better" in the sense that it uses Raku regexes, which are incredibly powerful, and if that's not enough for you, you can even write code. "rak" is giving you a general-purpose programming language (Raku) that is optimized for text processing, with convenient shortcuts for the most common tasks. In contrast "rg" only designed to search text files, but it does that really really fast. I makes sense to have both.

It definitely makes sense to have this tool if you're comfortable writing Raku. I'm not sure it makes a whole lot of sense for most people to learn Raku to use this tool, and if you're not going to learn Raku I don't think there's much value add over tools like ripgrep.

Re: App::Rak – 21st century grep / find / ack / ag / rg on steroids

#42
There is problem with nice modern Linux tools - they are not available on the generic servers and embedded boxes with you will likely use, or in the image someone else has given you etc. Therefore it is pointless (sorry for the strong term) to learn them, because they simply won't be available for when they are most needed. And learning new tools is not a free process, there are costs, mental and time.

Re: App::Rak – 21st century grep / find / ack / ag / rg on steroids

#44
Author of ripgrep here.

Very cool! It looks like Rak has a lot of nice features.

I will say that getting this thing built took some digging. Could you please add install/build instructions to the README? As it is, I had to go sleuthing through your CI setup to figure it out. On Archlinux, here's what I did:

    $ yay -S rakudo-bin
    $ export PATH="/usr/share/perl6/site/bin:$PATH"
    $ git clone https://github.com/lizmat/App-Rak
    $ cd App-Rak
    $ zef install .
    $ export PATH="$HOME/.raku/bin:$PATH"
I realize features and an expressive language is your main goal, but I wanted to see what it looked like from a perf perspective:

    $ git remote -v
    origin  git@github.com:rust-lang/rust (fetch)
    origin  git@github.com:rust-lang/rust (push)

    $ git rev-parse HEAD
    699f4a637ef382ea0716c72f60d0c1c4cd79df41

    $ time rg accelerated --files-with-matches
    compiler/rustc_target/src/spec/thumbv7em_none_eabi.rs
    src/llvm-project/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    src/llvm-project/llvm/docs/PDB/HashTable.rst

    real    0.126
    user    0.544
    sys     0.850
    maxmem  22 MB
    faults  0

    $ time rak accelerated --files-with-matches
    compiler/rustc_target/src/spec/thumbv7em_none_eabi.rs
    src/llvm-project/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    src/llvm-project/llvm/docs/PDB/HashTable.rst

    real    17.005
    user    2:07.88
    sys     8.866
    maxmem  1565 MB
    faults  0
I'm not totally clear on what kind of filtering `rak` does by default, so I also ran a search on a single plain text file:

    $ cd /dev/shm
    $ curl -LO https://burntsushi.net/stuff/opensubtitles/2018/en/sixteenth.txt.gz
    $ gunzip sixteenth.txt.gz
    $ time rg 'Sherlock Holmes' sixteenth.txt -c
    426

    real    0.068
    user    0.047
    sys     0.020
    maxmem  778 MB
    faults  0

    $ time rg 'Sherlock Holmes' sixteenth.txt -c --no-mmap
    426

    real    0.089
    user    0.026
    sys     0.063
    maxmem  14 MB
    faults  0

    $ time rak 'Sherlock Holmes' sixteenth.txt --count-only
    426 matches in 1 file

    real    48.236
    user    48.010
    sys     0.334
    maxmem  215 MB
    faults  0

    $ time grep 'Sherlock Holmes' sixteenth.txt -c
    426

    real    0.297
    user    0.233
    sys     0.063
    maxmem  14 MB
    faults  0

Re: App::Rak – 21st century grep / find / ack / ag / rg on steroids

#45
post #42

There is problem with nice modern Linux tools - they are not available on the generic servers and embedded boxes with you will likely use, or in the image someone else has given you etc. Therefore it is pointless (sorry for the strong term) to learn them, because they simply won't be available for when they are most needed. And learning new tools is not a free process, there are costs, mental and time.

I think you need to caveat the word "pointless" heavily. If 95% of the commands I type are in my local dev environment where I can install a variety of tools, then I don't see how it's pointless to learn different tools for the common case. Otherwise, you're just needlessly limiting yourself to a constrained set of tooling with zero opportunity for any kind of progress or improvement.

Even though I'm the author of ripgrep, believe it or not, I still use grep in those 5% of cases without any kind of fuss.

Re: App::Rak – 21st century grep / find / ack / ag / rg on steroids

#46

Earlier quoted context omitted.

Well right, "perl 6" quickly became a bad name for the project - they should have switched to something like "raku" maybe 20 years ago. Given that, nobody got the memo, so calling it "perl 6" is still a very fast way to orient people as to what it's a neighbor of.

Maybe a fast way but is it a fair or even helpful way, if you recognize that it "quickly became a bad name for the project"?

It is helpful for people who were paying attention to the perl community with any passing interest at any time in the past 20 years. It is not helpful for people who weren't. But the former describes a lot of people here.

Re: App::Rak – 21st century grep / find / ack / ag / rg on steroids

#47

Author of ripgrep here. Very cool! It looks like Rak has a lot of nice features. I will say that getting this thing built took some digging. Could you please add install/build instructions to the README? As it is, I had to go sleuthing through your CI setup to figure it out. On Archlinux, here's what I did: $ yay -S rakudo-bin $ export PATH="/usr/share/perl6/site/bin:$PATH" $ git clone https://github.com/lizmat/App-R…

Wow, thanks for doing the perf comparison.

Re: App::Rak – 21st century grep / find / ack / ag / rg on steroids

#48
post #42

There is problem with nice modern Linux tools - they are not available on the generic servers and embedded boxes with you will likely use, or in the image someone else has given you etc. Therefore it is pointless (sorry for the strong term) to learn them, because they simply won't be available for when they are most needed. And learning new tools is not a free process, there are costs, mental and time.

This is probably a good default position for a random new tool that floats across hacker news, but there are plenty of situations where the benefits of having a tool (even if only in your local environment) outweigh the effort of learning it and getting it.

Re: App::Rak – 21st century grep / find / ack / ag / rg on steroids

#50
post #28

Earlier quoted context omitted.

The examples are all undeniably verbose, but the source shows that many short options are also supported, specifically to copy those you would expect if migrating from the alternatives: https://github.com/lizmat/App-Rak/blob/main/lib/App/Rak.raku... So rak -C2 foo will do what you expect. [Edited to add] Also, the `\b...\b` form is shorter with rak - as the README also states where it documents this pattern form: > §…

> §string > If the pattern starts with §, Is it April 1st already?!

Raku embraces Unicode in a big way, and probably influenced this decision.

I wonder if keyboards in the future will settle on a way to provide access to more characters, than is currently common.

Post reply on HN