From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <20130323100519.GA3980@polynum.com> <19750d1b50c54941f031f57dc4be456e@proxima.alt.za> <5099C9E8-C6E8-4B6B-A609-B5BDCA6C332F@lsub.org> <5C91EC08-2559-4DA8-B6F3-9293747EEFE8@gmail.com> <20130323173739.GA3314@polynum.com> Date: Sat, 23 Mar 2013 13:13:53 -0600 Message-ID: From: andrey mirtchovski To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] gcc not an option for Plan9 Topicbox-Message-UUID: 319a2056-ead8-11e9-9d60-3106f5b1d025 this is not a new discussion, it started in november 2009. the fact that it's just coming to 9fans is a sign of how far behind the times we are :( the go runtime is ~380k. that one you must carry always even in an empty program (see below). what you're complaining about is the side-effect of importing fmt and other big packages such as os and net. with fmt you're sucking in all the unicode code tables and the reflection code used to process printing arguments (which you can't prove will not be used). the initial jump is big, but as your code grows the binary size tends to increase slower -- all of the imports are already in. the biggest program from the Go distribution frequently in use is "godoc". it deals with xml, json, binary encoding, directory navigation, document preparation, source code parsing, compression/decompression and serves the major website for go -- golang.org... that program, statically linked, is 8 megs (64-bit). i've seen things that deal with graphics which get to 20 megs. that is reasonable, i think. here's an illustrative progression of go binary sizes: $ cat > t.go package main func main(){ } $ go build t.go; ls -l t -rwxr-xr-x 1 andrey wheel 384880 Mar 23 12:43 t $ cat > t.go package main func main(){ println("hello") } $ go build t.go; ls -l t; ./t -rwxr-xr-x 1 andrey wheel 389008 Mar 23 12:43 t hello $ cat > t.go package main import "unicode" var _ = unicode.MaxRune func main() { } $ go build t.go; ls -l t -rwxr-xr-x 1 andrey wheel 581024 Mar 23 12:45 t $ cat > t.go package main import "fmt" var _ = fmt.Println func main(){ } $ go build t.go; ls -l t -rwxr-xr-x 1 andrey wheel 1481920 Mar 23 12:44 t