4 ms·
Golang binaries are also very large [0]. package main func main() { println("Hello, world") } That compiles to 1.1M using go 1.5. 0. https://github
by neopallium 10y ago
Golang binaries are also very large [0].
package main
func main() {
println("Hello, world")
}
That compiles to 1.1M using go 1.5.
0. https://github.com/golang/go/issues/6853 https://github.com/golang/go/issues/6853
- cgag 10y agoGo doesn't pride itself on not having a runtime though. People aren't surprised that there's space taken up by the garbage collector and green thread management and such.
- ComputerGuru 10y agoI don't understand your remark. To the contrary, a runtime should decrease binary size. The same PHP script (interpreted not JIT or VM'd though, obviously) will be only a few hundred bytes..
- Retra 10y agoAren't you just assuming the runtime is dynamically available? This is not a necessary feature of a runtime. You could compile PHP and add the size of the interpreter to the executable.
- cgag 10y agoThe runtime in this case is compiled into the binary. With php, the runtime is all contained in the php binary that runs your scripts, in Go's case, the runtime is copied into every binary it produces.
- nowprovision 10y agoFor a more true comparison with external scripting runtimes one can do: go run main.go Although this would be ill-advised, kind of like PHP in general..
- cgag 10y agoI'm not sure what you mean. Isn't this equivalent to `go build main.go && ./main`?
- nindalf 10y agoIt is. Not sure if the other guy has ever used Go.
- nowprovision 10y agoHmm it would seem so, I could of sworn it was different, my bad.
- nowprovision 10y agoHmm it would seem so, I could of sworn it was different, my bad.
- andrewchambers 10y agoeach go binary is self contained and has the entire runtime linked into it. I'm sure you will find the php runtime is many megabytes.
- pjmlp 10y agoBy default yes, but they are adding dynamic linking support. So far it only works on GNU/Linux I think.