Fog Creek Software
g
Discussion Board




2 mb of code how many LOC roughly?

Any idea hopw large a 2 mb source code repository is in LOC?

SR
Tuesday, January 6, 2004

Hard to say...What language? Is the debug information included?

2 MB of assembly language is a *whole* bunch of code, but 2MB in a VB program is very little code.

Mark Hoffman
Tuesday, January 6, 2004

There is no correlation between 2mb of code and the number of lines of code contained within.

It's just what I do when I can't get no lovin
Tuesday, January 6, 2004

2 MB of C++ code with debug info

SR
Tuesday, January 6, 2004

What the last guy said.

First ensure the file is uncompressed.

Ensure you are not looking at an revision control archival (assuming you don't know what this is, it's a file that contains all the history of the edits that happens to a collection of files, meaning if default.asp ends up being 40k today, it probably started off at 1K last month, then 5K last monday, then 20K last thursday, then finally 40k today, an revision control archive tracks all the changes)

Then do a line count.

Li-fan Chen
Tuesday, January 6, 2004

What's the debug info?

I wrote a program in C++. It is 20,000 lines (Approx) and the source takes 1MB... but take care!

Firstly, the debug info for one of the modules (240K, 8000 lines approx) is 8MB. So it's possible that it's the debug info taking up all the space.

Secondly, note that 8000 lines takes up 240K. This means the other 12000 take up 750K.

In the absence of being able to actually find out, I suggest you make a random guess.

Insert half smiley here.
Tuesday, January 6, 2004

Just curious: Why do you want to know?

LOC is not usually a useful metric for much of anything.

XYZZY
Tuesday, January 6, 2004

Do I win a jar of sweeties if I get it right?

Simon Lucy
Wednesday, January 7, 2004

cat *.cpp *.h|wc -l
47906

ls -l *.o|awk '{ sum += $5; } END { print sum; }'
98903404

With debug info.  YMMV.

David Jones
Wednesday, January 7, 2004

The op asked...

>Any idea hopw large a 2 mb source code repository is in LOC?

2 mb source code repository...source code being the operative word...not an object code repository so there is no question of debug info being there or not...it is just plain good 'ol ascii source...

Assuming about 20 lines of code per page with a page being about 2000 chars, 2 mb would be about 20000 lines of code....whether that is useful code or not is another question  :-) and I would not base a PHd thesis on these calculations ;-)

Code Monkey
Wednesday, January 7, 2004

The source code repository probably contains mutliple versions of the same file.  Most source code control systems only store the differences (or better the reverse-differences) needed to generate the files.

It is impossible to correlate the size of the archive to the number of code lines that make up the most recent version of the files in the archive.

Even a very small file that is changed enough could take a huge amount of storage in the archive.

XYZZY
Wednesday, January 7, 2004

*  Recent Topics

*  Fog Creek Home