4 ms·
GopherJS will compile large chunks of the Go stdlib, so the base size is a few 100KB. As your app grows, the generated code should approach the size of a normal
by AYBABTME 12y ago
GopherJS will compile large chunks of the Go stdlib, so the base size is a few 100KB. As your app grows, the generated code should approach the size of a normal JS app of similar size.
For instance, this demo uses the `fmt` package from the stdlib, which imports a whole lot of things. In normal Go programs, importing `fmt` means growing you binary size by a large bump.
https://github.com/tidwall/digitalrain/blob/master/digitalrain.go#L5 https://github.com/tidwall/digitalrain/blob/master/digitalra...
I know the Go authors are concerned about the size of generated binaries, or at least have expressed concerns in the past. I don't know how work on that would translate in improvement to GopherJS' codegen.
- TazeTSchnitzel 12y agoWhy doesn't it do tree shaking to eliminate unused Go stdlib stuff?
- tidwall 12y agoDead code elimination is built in, but not super duper yet. There's daily updates to the project and it seems to get tighter every week.