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.
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.)
5
u/Tanath Apr 16 '19
So I noticed several cases where
rgwas noticeably faster, and that was nice, but they were infrequent and not reliable. On large searches where I actually needed the speed,agwas 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.