Strip debug symbols from Wasm binaries
x1unix opened this issue · comments
Problem
Wasm binaries produced by Go compiler are pretty huge.
Sometimes they may crash browsers (Safari on iPhone) due to Wasm memory usage quota.
Solution
Add -ldflags "-s -w"
build flags to strip debug info. This might save a few megabytes. This should be enough for simple applications to fit in WebKit memory quota.
Combination of -ldflags '-s -w'
and -trimpath
flags helped to reduce Go interpreter from 36MB to 35.3MB (2%)