Live data from Hacker News

How FZF and ripgrep improved my workflow

medium.com

71–80 of 89 posts

Re: How FZF and ripgrep improved my workflow

#71
I see these Vim-enhancment posts a lot. If you need to install a mountain of plugins just to make it usable, why not use a more modern editor? Seems like nostalgia for the Unix greybeard era, possibly some eletism for when someone who isn't intimately familiar with their config has to ask for help to use their machine.

Re: How FZF and ripgrep improved my workflow

#73

> 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.

Re: How FZF and ripgrep improved my workflow

#74

Earlier quoted context omitted.

I did an extensive comparison a while ago: https://blog.burntsushi.net/ripgrep/ --- It should still largely be pretty accurate (and ripgrep has only gotten faster). More generally, if someone can find a non-trivial example of ag being faster then ripgrep, then I'd love to have a bug report. (Where non-trivial probably means something like "not I/O bound" and "not so short that the differences are human imperceptible…

I'm currently working on a searcher on my own: https://github.com/elsamuko/fsrc When I started, I didn't know ripgrep, now I use it as reference. Of course it's still slower for regex searches and it has less options, but in some cases (e.g. simple string matching search), it is faster than rg (PM_RESUME in 160-170ms), mostly thanks to mischasan's fast strstr: https://mischasan.wordpress.com/2011/07/16/convergence-ss…

I don't see any build instructions, so I don't know how to try it. Sorry. I did run `./scripts/build_boost.sh`, but that didn't produce any `fsrc` binary that I could use.

I would also caution you to make sure you're benchmarking equivalent workloads.

Re: How FZF and ripgrep improved my workflow

#75

Earlier quoted context omitted.

I'm currently working on a searcher on my own: https://github.com/elsamuko/fsrc When I started, I didn't know ripgrep, now I use it as reference. Of course it's still slower for regex searches and it has less options, but in some cases (e.g. simple string matching search), it is faster than rg (PM_RESUME in 160-170ms), mostly thanks to mischasan's fast strstr: https://mischasan.wordpress.com/2011/07/16/convergence-ss…

I don't see any build instructions, so I don't know how to try it. Sorry. I did run `./scripts/build_boost.sh`, but that didn't produce any `fsrc` binary that I could use. I would also caution you to make sure you're benchmarking equivalent workloads.

There are no build instructions yet, you need to build boost with build_boost.sh and then open qmake/fsrc.pro with Qt Creator. There are binaries available here, too: https://github.com/elsamuko/fsrc/releases

And I know than benchmarking is hard, a coarse comparison is in scripts/compare.sh. More detailed performance tests are in test/TestPerformance.

Re: How FZF and ripgrep improved my workflow

#76
post #71

I see these Vim-enhancment posts a lot. If you need to install a mountain of plugins just to make it usable, why not use a more modern editor? Seems like nostalgia for the Unix greybeard era, possibly some eletism for when someone who isn't intimately familiar with their config has to ask for help to use their machine.

Exactly. I use a modern editor whenever I'm working on one of my main computers, and the only time I use vim is when I'm working on a remote server and can't mount the drive remotely (or where mounting would just be a pain). Because of that, I don't want any plugins when I use vim as I'll probably be using it on a new machine every time, and setting up my environment would be a waste of time.

Re: How FZF and ripgrep improved my workflow

#77
post #71

I see these Vim-enhancment posts a lot. If you need to install a mountain of plugins just to make it usable, why not use a more modern editor? Seems like nostalgia for the Unix greybeard era, possibly some eletism for when someone who isn't intimately familiar with their config has to ask for help to use their machine.

Vim is activly developed, with major new features like a terminal emulator and async arriving in the latests versions. You need to better define “modern”.

Re: How FZF and ripgrep improved my workflow

#78
post #59

Earlier quoted context omitted.

ido-mode was the standard back in the day. I have since moved to ivy/swiper but it was ido-mode that showed me the way some ten years ago (or more). One sad thing about FZF is that it doesn't also support tab-completion. Both ido and ivy support both tab-completion and fuzzy searching at the same time. They compliment each other really well and make these both much more general purpose tools. One import application i…

What made you switch? I'm still using Ido-mode and is quite happy.

I went back and forth for a bit. Ultimately ivy was faster, though, which meant I could use it for more things. I used ido-hacks before which sped ido up enough to use it for M-x, but ivy is already easily fast enough for that.

Re: How FZF and ripgrep improved my workflow

#79
post #70

Earlier quoted context omitted.

Honestly? I derive pleasure from hard work. I'm somewhat of a masochist in that way, I guess. I shun convenience and choose the hard path towards personal enlightenment.

Curious what the rest of your dev env is...

I run Gentoo. Very minimal system. Really quick. sway window manager (i3 clone for wayland). It's probably not as bad as I made it sound, though. I use tools and I am always trying to automate away any work in my life. But I like simple tools that I can understand. I don't like magic. I won't use a tool that promises to solve all my problems and make me rich at the same time. I like to stay on top of it all.

Re: How FZF and ripgrep improved my workflow

#80
post #76
post #71

I see these Vim-enhancment posts a lot. If you need to install a mountain of plugins just to make it usable, why not use a more modern editor? Seems like nostalgia for the Unix greybeard era, possibly some eletism for when someone who isn't intimately familiar with their config has to ask for help to use their machine.

Exactly. I use a modern editor whenever I'm working on one of my main computers, and the only time I use vim is when I'm working on a remote server and can't mount the drive remotely (or where mounting would just be a pain). Because of that, I don't want any plugins when I use vim as I'll probably be using it on a new machine every time, and setting up my environment would be a waste of time.

Setting up your vim environment is as cloning a git repository that contains your .vim files. Takes me about ~60 seconds to have vim up and running with all my favorite plugins. That's faster than you can download and install any other text editor. It's what I've been doing on just about every machine I've used for the past 5 years.

There are situations where git is not installed or I can't download those files for security reasons set by administrators, but those situations have been pretty rare for me.

Post reply on HN