What makes ripgrep so fast ?

177 points almandin_jv

Hi, I'm working on a similar tool and cant figure what makes ripgrep so fast. Actually, on a single file, ripgrep is almost as fast at parsing than a simple naive program only reading the same file with a BufReader.
I'd like to understand what mechanisms make ripgrep so fast at parsing single independant files. I believe the way it reads files and buffers data before parsing them is very important but couldnt figure where to search in its source code.
Any hints ? I naively believed that reading a file buffered was already the best it could do but obviously it does something more.
thanks !