>Counting Lines

2009/05/03 — 5 Comments

>Out of curiosity, I decided to see how many lines of code are in the Mozilla central repo.

I used CLOC, which stands for “Counting Lines of Code” a fast perl program http://cloc.sourceforge.net


ddahl-t500 ~ % perl ~/bin/cloc.pl --exclude-dir=.hg ~/code/moz/mozilla-central/mozilla
34572 text files.
33534 unique files.
56892 files ignored.

http://cloc.sourceforge.net v 1.08 T=134.0 s (204.0 files/s, 45458.4 lines/s)
--------------------------------------------------------------------------------
Language files blank comment code scale 3rd gen. equiv
--------------------------------------------------------------------------------
C++ 3096 246458 281710 1224917 x 1.51 = 1849624.67
C 1670 166078 241676 894512 x 0.77 = 688774.24
HTML 10113 92348 19579 625324 x 1.90 = 1188115.60
Javascript 4756 156677 221426 471609 x 1.48 = 697981.32
C/C++ Header 4109 100775 310865 413259 x 1.00 = 413259.00
IDL 1250 12107 0 120206 x 3.80 = 456782.80
Bourne Shell 220 16398 20518 106269 x 3.81 = 404884.89
Assembly 100 4545 2967 53678 x 0.25 = 13419.50
XML 650 14244 8639 50284 x 1.90 = 95539.60
Perl 242 6613 11643 30146 x 4.00 = 120584.00
CSS 463 7264 12306 30108 x 1.00 = 30108.00
Python 128 4880 12547 20428 x 4.20 = 85797.60
m4 22 1873 287 15602 x 1.00 = 15602.00
Java 129 2782 5736 11613 x 1.36 = 15793.68
DTD 141 2321 3028 10117 x 1.90 = 19222.30
Teamcenter def 43 60 2 4930 x 1.00 = 4930.00
SKILL 5 79 3 2680 x 2.00 = 5360.00
make 94 1554 4818 2620 x 2.50 = 6550.00
Objective C 3 235 211 959 x 2.96 = 2838.64
DOS Batch 42 175 121 621 x 0.63 = 391.23
Bourne Again Shell 5 138 452 503 x 3.81 = 1916.43
C# 4 57 261 453 x 1.36 = 616.08
Korn Shell 4 44 249 303 x 3.81 = 1154.43
Pascal 5 56 29 295 x 0.88 = 259.60
MATLAB 2 48 0 277 x 4.00 = 1108.00
Lisp 1 30 32 256 x 1.25 = 320.00
PHP 2 75 126 248 x 3.50 = 868.00
MSBuild scripts 2 2 0 242 x 1.90 = 459.80
XSLT 8 52 36 234 x 1.90 = 444.60
lex 2 64 59 223 x 1.00 = 223.00
Visual Basic 7 30 349 143 x 2.76 = 394.68
yacc 1 15 42 79 x 1.51 = 119.29
awk 3 15 46 70 x 3.81 = 266.70
SQL 1 2 0 56 x 2.29 = 128.24
sed 4 1 0 52 x 4.00 = 208.00
Ada 1 5 0 49 x 0.52 = 25.48
C Shell 2 22 13 40 x 3.81 = 152.40
D 2 7 98 16 x 1.70 = 27.20
Expect 1 0 0 1 x 2.00 = 2.00
--------------------------------------------------------------------------------
SUM: 27333 838129 1159874 4093422 x 1.50 = 6124253.00
--------------------------------------------------------------------------------

So: 4 million lines of code, wow.

What about Chrome?


ddahl-t500 ~ % perl ~/bin/cloc.pl --exclude-dir=.hg ~/code/cpp/home/chrome-svn/tarball/chromium/src
36331 text files.
34106 unique files.
118852 files ignored.

http://cloc.sourceforge.net v 1.08 T=169.0 s (100.0 files/s, 28630.1 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code scale 3rd gen. equiv
-------------------------------------------------------------------------------
C++ 4567 219341 217686 1074656 x 1.51 = 1622730.56
C 657 76387 135868 526696 x 0.77 = 405555.92
C/C++ Header 5501 142924 330982 489098 x 1.00 = 489098.00
Perl 1463 98760 135606 270429 x 4.00 = 1081716.00
Python 1202 45766 70503 200647 x 4.20 = 842717.40
Javascript 1678 37060 71865 184861 x 1.48 = 273594.28
Bourne Shell 113 18492 22420 137002 x 3.81 = 521977.62
Assembly 4 60 44 131490 x 0.25 = 32872.50
HTML 741 4491 1244 44920 x 1.90 = 85348.00
m4 18 4361 228 37068 x 1.00 = 37068.00
Objective C 185 6036 7799 29487 x 2.96 = 87281.52
IDL 342 1666 0 13779 x 3.80 = 52360.20
XML 208 604 712 6651 x 1.90 = 12636.90
CSS 30 1319 437 6492 x 1.00 = 6492.00
make 55 852 960 5860 x 2.50 = 14650.00
Tcl/Tk 23 810 1196 5507 x 4.00 = 22028.00
yacc 4 572 171 4532 x 1.51 = 6843.32
Expect 15 4 2 2113 x 2.00 = 4226.00
MATLAB 18 222 0 1937 x 4.00 = 7748.00
XSD 3 143 1129 1587 x 1.90 = 3015.30
C# 11 182 632 1226 x 1.36 = 1667.36
DOS Batch 31 138 86 649 x 0.63 = 408.87
Teamcenter def 16 29 88 521 x 1.00 = 521.00
XSLT 2 10 28 294 x 1.90 = 558.60
Korn Shell 1 39 46 223 x 3.81 = 849.63
awk 6 6 84 211 x 3.81 = 803.91
Java 4 27 0 106 x 1.36 = 144.16
MSBuild scripts 1 0 7 100 x 1.90 = 190.00
YAML 1 0 0 84 x 0.90 = 75.60
MUMPS 1 2 0 29 x 4.21 = 122.09
sed 2 0 10 26 x 4.00 = 104.00
Ruby 1 10 7 15 x 4.20 = 63.00
D 1 3 24 13 x 1.70 = 22.10
PHP 1 0 0 3 x 3.50 = 10.50
-------------------------------------------------------------------------------
SUM: 16906 660316 999864 3178312 x 1.77 = 5615500.34
-------------------------------------------------------------------------------

3.1 million lines…
Looks like they are catching up on us. By one metric anyway:P

If this doesn’t seem correct let me know.

Advertisements

5 responses to >Counting Lines

  1. 

    >Any chance of running this only on code that’s actually shipped?

  2. 

    >I had a feeling I was missing something like that. I’ll have to ask around next week to see what to exclude. Thanks!

  3. 

    >Just getting “shipping code” is tough… for example, does debug code count? It probably does if the question is approachability of codebase.You do want to exclude test code (e.g. those 600kloc of HTML in the Firefox case).

  4. 

    >You might also consider passing -no3, to avoid outputting the pure fantasy “3rd-generation equivalent” numbers.Better yet, use a better code counting tool, like Ohloh’s ohcount.Even better, just point Ohloh at the appropriate repositories.

  5. 

    >Recently I did some quick and dirty LOC analysis using Ohloh:http://www.haloscan.com/comments/ericsinksoftware/1765/#171769

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s