5 ms·
I didn't know go compiler allowed to build without those, thanks. I've just tried on a go binary that was 2.4MO. After building it with `go build -ldflags=-s .
by oelmekki 9y ago
I didn't know go compiler allowed to build without those, thanks.
I've just tried on a go binary that was 2.4MO. After building it with `go build -ldflags=-s .`, it's 1.6MO. After stripping with upx, it's 480ko (and still works, and has panic stack traces).
- killercup 9y agoPlease note that upx also compresses your binary contents and decompresses it at runtime. When downloading a WASM file over HTTP, the server can gzip it transparently. It'd be interesting to compare the effects on the size with what upx does (which is more specialized than gzip).
- oelmekki 9y agoI see, thanks. I used vanilla `strip` on my binary and it did not produce any size gain (so the strip flag of go compiler is plenty enough). Indeed, given how browsers already handle gunziping resources, it's probably best to rely on it. My binary, stripped by the go compiler and gziped, is 525ko (against 480ko using upx).
- yjftsjthsd-h 9y agoCould it also be that Go encodes symbols in a way that strip can't read, or is is just standard ELF stuff?
- brobinson 9y agoDon't forget the "-w" linker flag, too.