Comparing C and Go Lang - My first impression

Of late we are hearing a lot about go lang (https://golang.org/). I was also curious about this. I wanted to run some experiments with go and C.

As expected, the experiment was started with "hello world".

Here is the C code that I have used:
------------------------------------------------
#include "stdio.h"

int main(int argc, char** argv)
{
   printf("hello, world\n");
   return 0;
}
------------------------------------------------

Corresponding go code is:
------------------------------------------------
package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}
------------------------------------------------

Well, both of them look simple. But I was astonished after creating the exe file. Below are the sizes of exe files created by C (51k) and Go(2MB)

06/03/2016  03:41 PM            51,712 hello_c.exe
06/03/2016  03:37 PM         2,434,560 hello_go.exe

I understand that go can do lot of things. But, I am really wondering why was it not optimized for size.

Comments

Popular posts from this blog

Graylog - an easy solution for log management

Nokia mobile phone - some Tips