ripgrep is faster than {grep, ag, git grep, ucg, pt, sift}
In this article I will introduce a new command line search tool,ripgrep, that combines the usability ofThe Silver Searcher (anack clone) with the raw performance of GNU grep. ripgrep is fast, cross platform (with binaries available for Linux, Mac and Windows) and written inRust.
ripgrep is available onGithub.
We will attempt to do the impossible: a fair benchmark comparison between several popular code search tools. Specifically, we will dive into a series of 25 benchmarks that substantiate the following claims:
• For both searching single files and huge directories of files, no other tool obviously stands above ripgrep in either performance or correctness.
• ripgrep is the only tool with proper Unicode support that doesn’t make you pay dearly for it.
• Tools that search many files at once are generally slower if they use memory maps, not faster.
As someone who has worked on text search in Rust in their free time for the last 2.5 years, and as the author of both ripgrep andthe underlying regular expression engine, I will use this opportunity to provide detailed insights into the performance of each code search tool. No benchmark will go unscrutinized!
Target audience: Some familiarity with Unicode, programming and some experience with working on the command line.
NOTE: I’m hearing reports from some people that rg isn’t as fast as I’ve claimed on their data. I’d love to help explain what’s going on, but to do that, I’ll need to be able to reproduce your results. If youfile an issue with something I can reproduce, I’d be happy to try and explain it.