knz / drknz

Comments for the web site at dr-knz.net
0 stars 0 forks source link

https://dr-knz.net/go-executable-size-visualization-with-d3-2021.html #3

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

My Go executable files are still large - What's new in 2021 and Go 1.16 · dr knz @ work

Note The latest version of this document can be found online at https://dr-knz.net/go-executable-size-visualization-with-d3-2021.html. Alternate formats: Source, PDF. Note After a lively discussion on Hacker News and input from Russ Cox, the conclusions in the analysis below were reworded to avoid the notion of “non-useful bytes”. The …

https://dr-knz.net/go-executable-size-visualization-with-d3-2021.html

Robert-M-Muench commented 3 years ago

Is there a way thinkable to strip the Go internal bytes? Assuming the information is still in line of pclntab all longer strings could be replaced by short IDs or even more radical zero-padded and later on compressed.

I'm wondering why there is no Go command line switch that allows to produce a binary where all Go internal bytes not necessary to run the program can be left out. Oc course, in case of a problem, one would only get a crash and no additional information. But many use-cases would be good with that.

knz commented 3 years ago

Many programs (cockroachdb included) use the strings inside stack traces to make decisions. They can't be omitted altogether without changing the go runtime APIs and the programs that use them.

Also the go internal bytes also contain metadata for each word/region of the static data segments that may contain pointer data, for the heap GC. This cannot be omitted without redesigning go's heap model.