Does size matter?

opensussex profile image gholden ・2 min read

I've been toying around with some development recently. I like to look at different languages, and I like to make a decision on the language based on what the project I might be building.

As such I was looking at 4 languages. C, C#, Go and Vala.

For this test I wanted to see the size of a simple "Hello, World!" program. This would just publish "Hello, World" out onto the console.

I was curious about the size of the binary file once compiled.

  • C = 8.6Kb
  • Vala = 9.43Kb
  • Go = 1.9Mb
  • C# = 35.6Mb
  • ASM = 920Bytes**

*Edit - none of the above have been optimised with their compilers - so these are default compilation to binary - I am sure they can be squeezed a bit more.

**Edit - After discussion on the size of the C binary, I thought it would be interesting to see what ASM would be... and it's tiny. So a lot of the C stuff is due to the stdio.h and redundant for actually printing text to the console.

Now, this isn't really fair, as C# was never really intended to run as a single binary - it just so happens now you can. But I was staggered at the size difference.

Also, Go is pretty bloaty.

Vala makes sense, as it essentially transpiles to C++ before final compilation.

And C - is super tiny.

So - what does this all mean? Does size really matter? Well that entirely depends on what you're trying to do. Embedded services, or running on a low tech bit of kit, then optimisation and size will matter.

The ease of development also matter. C can be pretty mind mending, having to think about garbage collection, and the finer detail of relatively low level stuff.

Go is a relatively simple language, and can be pretty quick to develop in.

Vala is getting closer to C# as syntax goes and are both competent OOP languages.

I'm not going to say which is best, as there is no winner. I was just curious about the outcome.

Posted on by:

opensussex profile



I'm a programmer that's interested in trying to keep things simple.


markdown guide

I'm looking at that and thinking 8KB is way too much.


ok, been playing with GCC and have reduced it down a bit... by using the -s flag. So you're right, it can be reduced. (got it down to 6Kb)


I'd love to see a way to get it smaller!


I just tried it using naive gcc which gave me 17KB and strip got it down to 14KB. I guess that's because of stdio but it's been so long since I wrote any C that I can't remember how it all fits together.

I wasn't particularly talking about C, though. I mean that using BIOS screen printing calls you can do it in a handful of bytes in asm, so I'm thinking that of that 8KB, 7.9KB is junk.

interesting you got 14KB - what os you compiling on?

I guess my next task, is to try it in pure ASM and see what the size is....

I'm on mint - I wouldn't have expected a difference in file size really.

In asm - works out to be 920Bytes.