Why does Go produce large binaries for small programs?

why does the go compiler produce large binaries?

For example, after compiling the following code, I get exec 1.8 MB file

package main
import "fmt"
func main(){
   fmt.Println("Hello World")
}

I tested the above code on both Ubuntu and Win7 , and the result will be the same!

I also wrote a large program with +70 lines of code, and the resulting binary was unexpectedly again 1.8 MB again (in fact, the difference in bytes was a bit). I am wondering what is dumped to the binary by the Go compiler.

+4
source share
1 answer

? ( Go):

gc (5l, 6l 8l) . , Go Go , , .

C "hello, world", gcc Linux, 750 kB, printf. Go fmt.Printf 1,2 , .

+13

Source: https://habr.com/ru/post/1543901/


All Articles