Someone asked (and then deleted their comment):

> How many LoC there is in ripgrep? 46sec to build a grep like tool with a powerful CPU seems crazy.

I wrote out an answer before I knew the comment was deleted, so... I'll just post it as a reply to myself...

-----

Well it takes 46 seconds with only a single thread. It takes ~7 seconds with many threads. In the 0.8.0 checkout, if I run `cargo vendor` and then tokei, I get:

$ tokei -trust src/ vendor/
===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
Rust 765 299692 276218 10274 13200
|- Markdown 387 21647 2902 14886 3859
(Total) 321339 279120 25160 17059
===============================================================================
Total 765 299692 276218 10274 13200
===============================================================================

So that's about a quarter million lines. But this is very likely to be a poor representation of actual complexity. If I had to guess, I'd say the vast majority of those lines are some kind of auto-generated thing. (Like Unicode tables.) That count also includes tests. Just by excluding winapi, for example, the count goes down to ~150,000.

If you only look at the code in the ripgrep repo (in the 0.8.0 checkout), then you get something like ~13K:

$ tokei -trust src globset grep ignore termcolor wincolor
===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
Rust 34 15484 13205 780 1499
|- Markdown 30 2300 6 1905 389
(Total) 17784 13211 2685 1888
===============================================================================
Total 34 15484 13205 780 1499
===============================================================================

It's probably also fair to count the regex engine too (version 0.2.6):

$ tokei -trust src regex-syntax
===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
Rust 29 22745 18873 2225 1647
|- Markdown 23 3250 285 2399 566
(Total) 25995 19158 4624 2213
===============================================================================
Total 29 22745 18873 2225 1647
===============================================================================

Where about 5K of that are Unicode tables.

So I don't know. Answering questions like this is actually a little tricky, and presumably you're looking for a barometer of how big the project is.

For comparison, GNU grep takes about 17s single threaded to build from scratch from its tarball:

$ time (./configure --prefix=/usr && make -j1)
real 17.639
user 9.948
sys 2.418
maxmem 77 MB
faults 31

Using `-j16` decreases the time to 14s, which is actually slower than a from scratch ripgrep 0.8.0 build. Primarily do to what appears to be a single threaded configure script for GNU grep.

So I dunno what seems crazy to you here honestly. It's also worth pointing out that ripgrep has quite a bit more functionality than something like GNU grep, and that functionality comes with a fair bit of code. (Gitignore matching, transcoding and Unicode come to mind.)