News for hackers. Stuff that matters.
Re:Go 1.17 Beta by pizza234 on Thursday June 10, 2021 @03:27PM (#27464562)
> require no shared libraries

One amusing downside: the Golang hello world binary takes 2 MB; when compiled with gcc though (against libgo, therefore, dynamically linked), it takes an astonishing 60 KB - not even 64 KB!

Re:Go 1.17 Beta by slx26 on Thursday June 10, 2021 @03:56PM (#27464994)
No one is actively happy about it, but when you account for garbage collection and other runtime stuff that goes into a regular go program, plus no dynamic linking... you have to be happy with the trade-off. It's the right one for most programs we will ever make.
Re:Go 1.17 Beta by throwaway894345 on Thursday June 10, 2021 @04:25PM (#27465320)
> It's the right one for most programs we will ever make.

Unless you’re in the lucrative hello world industry. Or at least I assume it’s lucrative since so many people come here posting about hello world binary sizes—it certainly seems to employ a lot of people.

Re:Go 1.17 Beta by simias on Thursday June 10, 2021 @03:51PM (#27464911)
That used to bother me with Rust as well, but frankly nowadays it's really hard to argue against it. Even in the embedded world you typically have enough flash these days that you're not counting a couple MBs, and as far as RAM is concerned you'd only save some memory if several binaries run simultaneously while linking to the same shared libs.

And even then it's not a sure win, because LTO can remove a lot of useless code from dependencies, so if you only use a small part of a dependency you might still be better off with static linking regardless of other factors.

It's pretty hard to justify the complexity and overhead of dynamic linking nowadays, IMO.

Re:Go 1.17 Beta by anderskaseorg on Thursday June 10, 2021 @04:37PM (#27465463)
Although it used to be worse, these days a standard Rust “Hello, world!” compiles to just 277 KB on Linux with ‘cargo build --release’ and ‘strip’—5× smaller than the equivalent for Go (and there are games you can play to get it down further).
Re:Go 1.17 Beta by simias on Thursday June 10, 2021 @05:26PM (#27466062)
Oh, that's very cool, I hadn't checked that in ages. Any idea on what Rust does better here? Better link time optimization? Or is the Go runtime just that heavier?
Re:Go 1.17 Beta by colin_mccabe on Thursday June 10, 2021 @06:24PM (#27466625)
Rust doesn't really have a "runtime" in the same sense that Go does. For example, Rust has no GC.
Re:Go 1.17 Beta by pjmlp on Thursday June 10, 2021 @04:00PM (#27465049)
Depends, dynamic linking is great for plugins, on the other hand I guess we have learnt that IPC is a better option for security and overall application stability.
Re:Go 1.17 Beta by sitzkrieg on Thursday June 10, 2021 @04:36PM (#27465449)
not counting MBs!? must be nice, havent developed on something with 1MB or more in years
Re:Go 1.17 Beta by simias on Thursday June 10, 2021 @05:22PM (#27466032)
You work on systems with 1MB of storage that support dynamic linking? Please tell me more, that sounds pretty insane to me.
Re:Go 1.17 Beta by foobiekr on Thursday June 10, 2021 @03:36PM (#27464685)
... and then someone puts it in a container, probably sourced without any kind of tracking, and blows cross-app shared library page sharing and adds tons of other on-media bloat.

It's so crazy where we are.

Re:Go 1.17 Beta by pjmlp on Thursday June 10, 2021 @04:02PM (#27465076)
I find it more ironic when monolithic kernels are argued for and then get placed in layers of abstraction to achieve what microkernels offer out of the box.
Re:Go 1.17 Beta by bitwize on Thursday June 10, 2021 @04:02PM (#27465070)
RAM and storage are cheap. Their cost is a mere pittance for the benefits of containerization.

It's like when people whinge about Electron. Electron gets you a runtime that's near identical across the major platforms, with a11y (something the Linux native toolkits still don't have their shit together on) essentially for free, plus you can use modern reactive component frameworks like React and Vue on the desktop. Yeah, I'll pay 300 MiB for that.

Re:Go 1.17 Beta by kaba0 on Thursday June 10, 2021 @04:26PM (#27465338)
I highly doubt that the optimal GUI development is at “modern reactive comp frameworks”, when decade old desktop frameworks had better tooling than that.
Re:Go 1.17 Beta by EvilEy3 on Thursday June 10, 2021 @04:40PM (#27465509)
I seriously doubt that. Mobile platforms and web would be moving towards "decade old desktop frameworks" if those were superior.
Re:Go 1.17 Beta by kaba0 on Thursday June 10, 2021 @04:49PM (#27465634)
Mobile platforms are most definitely not web technology, they are much closer to desktop frameworks. And the only reason the web is not doing so is (was) due to backwards compatibility and HTML being a bad target. But with WASM and canvas-based renderers, desktop frameworks sort of make an appearance on the web (though I personally dislike the canvas-oriented design, which basically throws away every accessibility)
Re:Go 1.17 Beta by brokencode on Thursday June 10, 2021 @03:32PM (#27464641)
For some applications this matters, but for a typical web server or web architecture, which is what go is optimized for, rarely if ever would a couple MB of binary size make a difference.
Re:Go 1.17 Beta by taywrobel on Thursday June 10, 2021 @03:45PM (#27464813)
Especially when tossed in a container for most workloads nowadays. You can have a full go binary statically linked and copied into a FROM SCRATCH docker image and it just works, and is miniscule.

For example, that's all that the production image of NATS Streaming is - https://github.com/nats-io/nats-streaming-docker/blob/024b04...