Re: Where the code goes?

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Mon, 20 Sep 1999 14:25:45 +0200 (MEST)


Adam Sulmicki wrote:
> In the end machine executable code always will be more compact that human
> readable code (at very least b/c lack of comments). for small programs
> binary is bigger becuase of overhead of starup code, but once source code
> gets big, the proportions reverse.

Assembly is tedious. One C statement might result in much more
assembly (& machine language) than you started with.

In the end, for normal applications you end up with about half the
amount of binary as what you wrote in code (in bytes). This is of
course, easily distorted by linking in lots of libraries (which you
shouldn't do). Or by having more comments than code. Or by counting
the symbols that are needed for linking.

Linux kernel uncompressed: 1.5M
stripped: 1.2M
random junk at the end of the file: 0.2M -> 1.0M
"strings" (printk formats etc) 0.13M -> 0.87M

So, as a rough guess, only about 2.4Mbyte out of the 60Mb of source
code is involved in generating the 1.2Mb linux-kernel.

One project:

new> strip t/*
new> wc t/*.o |tail -1
848 6333 313696 total
new> wc *.c | tail -1
29374 81917 911014 total

Other project:
3dgr> wc *.c | tail -1
25951 93410 752122 total
3dgr> wc *.o | tail -1
1008 7372 301752 total
3dgr>

Regards,

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
------ Microsoft SELLS you Windows, Linux GIVES you the whole house ------

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/