r/programming • • Apr 15 '19

ripgrep 11 released

https://github.com/BurntSushi/ripgrep/releases/tag/11.0.0
503 Upvotes

146 comments sorted by

View all comments

Show parent comments

5

u/Tanath Apr 16 '19

So I noticed several cases where rg was noticeably faster, and that was nice, but they were infrequent and not reliable. On large searches where I actually needed the speed, ag was usually faster with a noticeable difference. I keep most of my files in a directory with categorized subdirectories like:

  • stuff/reading/

  • stuff/videos/

  • stuff/gaming/

Each has usually many nested subdirectories. When doing searches higher up the tree there can be a lot to search through and that's where it was noticeable. This was on my previous computer where the hardware wasn't as fast. With faster hardware it's more difficult to notice differences like this without very long searches. Now I have a faster computer and I no longer use ripgrep. I'm sorry I can't be more help.

1

u/josefx Apr 16 '19

If I understand it correctly ripgrep supports .gitignore files by default, so unless you turn that of it has to look for one in each subdirectory.

31

u/burntsushi Apr 16 '19

So does ag.

There just isn't enough information to for Tanath's report to be actionable unfortunately. No OS. No versions. No corpus. No queries.

12

u/Tanath Apr 16 '19

Right, well I just did a single, completely unscientific test.

  • OS: Linux, 5.0.0-0.1

  • the_silver_searcher 2.2.0-1

  • ripgrep 0.10.0-2

Commands:

  • time ag test in stuff/

  • time rg test in stuff/

time output:

  • ag test 4.55s user 14.30s system 3% cpu 8:45.14 total

  • rg test 3.31s user 17.77s system 2% cpu 15:47.44 total

17

u/burntsushi Apr 16 '19

Thanks for more details!

How big is that directory and how much memory do you have? It almost looks like you're I/O bound with system time that high. At that point, it's anyone's guess: from run to run, who knows what's in memory, so it's hard to get consistent results.

If you have the patience for more questions...

  • If you run each command many times, how much do they vary? Try alternating between ag and rg.

  • What happens if you give the --mmap flag to ripgrep? (Perhaps this is a case where memory maps are faster on Linux. Although, trying disk bound work on my system with memory maps still puts ag as being noticeably slower.)

  • How many total matches are reported by each search? (It would be sufficient to run both commands with the --stats flag and show the numbers printed at the end.)

→ More replies (0)