Linecount

This page is to measure the number of lines of source code of various types of program. That is useless for spotting extremely lean/minimal/simple programs and detecting insanity/bloat/excessive complexity.

The measurements are usually .c then .h.

If anything is wrong please feel free to update it or inform me.


 * This site has line counts for lots of software: https://www.openhub.net/

Script
Here is a script to count lines of code:

find "$1" -name "$2" -exec wc -l {} \; | awk '{ SUM += $0 } END { print SUM }'

Thanks to http://stackoverflow.com/questions/1358540/how-to-count-all-the-lines-of-code-in-a-directory-recursively/16212299#16212299

it's important not to use xargs, there might be more files that command line handles. This is silently ignored and you get wrong results.

Shells
In the case of scsh we measure .scm, .c, .h

gnu bash:    138227,  13746 zsh:         135589,   5698 shivers scsh: 118475, 27131, 1985 templeos:    119115,      0 mirbsd mksh:  29223,   2562 debian dash:  16503,   2084 freebsd sh:   15453,   1622 es shell:      9017,   1436 plan9 rc:      5989,    327 execline:      3794,    117

bash has the highest linecount here. I think that is part of why the shellshock vulnerability happened.

Kernels

 * for plan9: Just the stuff inside `plan9/sys/src/9/`
 * for minix3: `minix/sys/` I hope that's correct.
 * for Mezzano by froggey, .lisp only, count the whole OS (includes a compiler, desktop programs).
 * sortix is .cpp.
 * toaruos, haiku and freeDOS is .c, .h, .S (assembly).
 * msdos 2.0 is thanks to http://www.computerhistory.org/atchm/microsoft-research-license-agreement-msdos-v1-1-v2-0/ and the code is in .ASM
 * xnu-3247.1.106 fetched from http://opensource.apple.com/release/os-x-1011/

linux-4.6-rc5: 15441922, 3878574 openbsd:       1963369,  911364 xnu-3247.1.106: 1001825, 276698 minix3:         377430,  262299 plan9:          229635,   25469 gnu hurd:       226383,   94836 haiku:          170842,   10483, 4613 templeos:       119115,       0 mezzano:         59763 msdos 2:         51686 sortix:          28838,   11103 seL4:            25916,   13017 freeDOS:         23944,    4924, 13192 toaruos:          9845,    9789, 381 xv6:              8173,    1181

C Compilers

 * clang also includes LLVM and CFE, is also in C++.
 * gcc also contains some C++ code, this is in the third column (first are .c and .h).
 * These probably contain some assembly files, these were not included.
 * 8cc is only 7000 lines without tests. Maybe we should delete tests before counting?

gcc-6.1.0:   2854201, 379272,   598 clang-3.8.0: 1523165, 169972 pcc-20160429: 112891,   9855 tcc-0.9.26:    36689,  39835 lcc-4.2:       25504,   3637 8cc:           10874,    718


 * "GCC Soars Past 14.5 Million Lines Of Code" - http://www.phoronix.com/scan.php?page=news_item&px=MTg3OTQ

web engines

 * webkitgtk and dillo is c++
 * servo is in rust, we count .rs then: find . -name '*.rs' -exec grep 'unsafe' {} \; | wc

webkitgtk-2.12.2: 1294484, 783733 netsurf-all-3.5:   461755,  76886 servo-...6254b401: 201351,   2682 lynx2-8-8:         158075,  26888 w3m-0.5.3:          57378,   5621 dillo-3.0.5:        39804,  14784

build system
cmake:           259555 lines of c                      215398 lines of c++ 89601 lines of cmake apache-ant-1.9.7: 268172 .java tup:             249258 lines of c    scons:             99570 .py    cabal:             86932 .hs                      (77950 with tests deleted) GNU make-4.2      39643: .c    autoconf:          25240 .m4    fac:                6113 .python 5893 .c