Why do executables have to be so fat?
Even tiny little programs like "Hello World" take up several KB when written in C and compiled with GCC.
I've also written Hellow World in x86 assembly, and it took up something like 86 bytes.
Why the big difference? cstdlib? Can't the compiler throw out code that isn't used?
5 comments
[ 2.4 ms ] story [ 25.2 ms ] threadSuch people hear, for example, that assembly is lower level than C, and as such can be faster, and have grand visions of rewriting operating systems and even mail clients in assembly.
Or talk about "bloat" regarding the size of executables, not realizing that the 400MB of, say, Pages.app is mostly template images, and that the real executable is like 1/10th the size.
Or, also that parts of code not needed are not even loaded from disk, so it doesn't matter if the raw executable code is 10MB, only how much of it is needed and how well it was written for speed.
That would only be a real problem if it kept happening proportionaly as programs grow in lines of code.
A 86 byte raw source program -> 3K can seem like a huge jump.
A 300,000 line, 1MB raw source program -> 1MB + 3K, or similar, would be insignificant.
You can always strip debugging symbols, remove libs you don't use, etc.