Open kadaan opened 4 years ago
This just means that startup time is longer.
For an explanation, see Why are my Go executable files so large?, the section header titled "Of size/performance trade-offs and use cases".
When is this trade-off warranted?
if a program is executed often (e.g. microservice, system tools), then it is worth accelerating its start-up time at the cost of an increase in size. If, moreover, the program is small, with relatively few functions, (a reasonable assumption for programs executed often, like microservices or system tools), the increase in size incurred byruntime.pclntab will be negligible and thus have no significant impact on usability: file transfers, deployments, orchestration, etc.In that case, the Go 1.2 design is sound and warranted.
if, in contrast, a program is executed rarely (e.g. a system service that runs continuously in the background, like, say… a database server), then the start-up time can be amortized throughout the lifetime of the process. The performance benefit of accelerating start-up is then not so clear. If, moreover, the program is large, with tens of thousands of of functions (a reasonable assumption for complex, feature-driven enterprise software like … database servers), the increase in size incurred by
runtime.pclntab
becomes inconveniently significant. This makes the Go 1.2 design … not so advantageous.
Using UPX you can shrink the size of the binaries from ~100mb to ~25mb. The settings I used were
upx -9 <BINARY>
.