loading...

SLOC counts of various projects

yujiri8 profile image Ryan Westlund ・3 min read

Ever since I found the tool cloc, I've found it primally satisfying to use it on stuff. How many lines of code does your favorite project manage its magic in? cloc shows you how the weight is split between languages as well as comments, blank lines, and real code.

I counted a bunch of various projects and thought the totals were rather interesting. I'm counting only the lines of code, excluding comments and blank lines.

  • ls (FreeBSD version) - 2600. 1800 of this is C, the other 800 sh (tests).

  • sh (FreeBSD version) - 13k. Ouch. And I used to toy with the idea of writing my own shell... yeah, maybe not. 12k C, 600 Make, 300 sh. Only a few hundred of these lines are tests.

  • Nano - 74k, but 56k of it is PO files. Only about 16k of actual code (all C).

  • Xpdf - 100k C++. Damn, to think it takes that much to render PDFs. Well okay, it does a lot more than that, but still.

  • Qutebrowser - 110k. The main code is about 40k lines of mostly Python; the tests add another 25k Python, 17k JS, 6500 of something I've never heard of called Cucumber, and a few other things. The other 20k comes from "./misc" and docs. So the job itself isn't as heavy as the total makes it sound, but still, sheesh. And it's just a browser frontend, not a rendering engine!

  • Xorg - 200k. I counted this a long time ago and wrote it down. If I remember correctly, this was only the xorg-server's count, but the repo was very confusingly structured, so it could be a very unfair count. (The repo was also exceedingly difficult to find and took me forever to download :))

So Mozilla has a slightly weird setup where all their stuff is in one repo.

  • PDF.js - 120k; 100k JS. (I counted all of browser/extensions/; but I know at least most of this is PDF.js)

  • Necko (netwerk/) - 380k. 160k C++, 80k C, 60k JS.

  • Firefox frontend (all of browser/, besides extensions/) - 700k. Phew! And I thought Qutebrowser was big! 600k is JS, 80k C++.

  • Gecko devtools alone - 950k. 855k of this is Javascript.

  • NSS - 1m, 700k C and 140k C++.

  • Spidermonkey (js/src/) - 2.4m. Holy shit! Just the Javascript engine! What's really surprising to me is that 1.6m of this is Javascript; there's only about 700k C and C++. I don't really see how this is possible given how barren the JS stdlib is.

For comparison to some other programming languages:

  • CPython (3.9.0 alpha) - 1m. What seemed to be the Python interpreter itself was only about 500k lines of C; the other 500k being the Python stdlib.

  • Google's Go implementation - 1.7m. 1.6m of it was Go. I'm surprised this is so much larger than CPython. And still so much lighter than Spidermonkey.

Oh, did I skip the actual Gecko rendering engine? I saved the best for last.

  • Gecko rendering engine - it's not obvious from their descriptions which dirs should even count as part of it, but I think the brunt of what counts is under layout/, dom/ and parser/. Combined, they're 3.5m. Somehow, 1.5m of this is HTML. There's about 1m C++ and 500k JS.

Posted on Mar 28 by:

yujiri8 profile

Ryan Westlund

@yujiri8

I'm a programmer, writer, and philosopher. My Github account is yujiri8; all my content besides code is at yujiri.xyz.

Discussion

markdown guide