Home / Companies / Cockroach Labs / Blog / Post Details
Content Deep Dive

Why are my Go executable files so large?

Blog post from Cockroach Labs

Post Details
Company
Date Published
Author
Raphael 'kena' Poss
Word Count
3,265
Language
English
Hacker News Points
468
Summary

Raphael 'kena' Poss delves into why Go executable files, such as those used in CockroachDB, are unexpectedly large, despite smaller increases in source code size. He created a visualization tool using D3 tree maps to explore the contents of Go binaries, revealing that a significant portion of the size increase is due to the `runtime.pclntab` object, which supports runtime stack trace generation and grows super-linearly with the number of functions. Originally intended to improve start-up times, this design choice from Go 1.2 is less beneficial for long-running server software like CockroachDB, where the increased binary size poses distribution and deployment challenges. The tool, available on GitHub, highlights other inefficiencies such as unused interface conversion tables and type functions that persist in the binaries, suggesting a need for optimization in Go's compilation process to better suit large-scale applications.