News for hackers. Stuff that matters.
Re:Decoded: GNU Coreutils by staplung on Friday September 08, 2023 @08:20PM (#37440947)
On my mac the go version of yes creates a binary that's 30x larger than the yes binary I have on a linux machine. 2MB vs ~65KB.
Re:Decoded: GNU Coreutils by svnpenn on Friday September 08, 2023 @08:29PM (#37440988)
on mine it is 1,354 KB. I prefer the 10x LOC savings over a megabyte of hard drive, but you do you.
Re:Decoded: GNU Coreutils by BenjiWiebe on Friday September 08, 2023 @09:14PM (#37441221)
But if everything was written in Go it might be 1 megabyte * the number of users of coreutils. Might be worth using a few more lines of code to save a little bit of space on a lot of machines.
Re:Decoded: GNU Coreutils by commonlisp94 on Friday September 08, 2023 @10:47PM (#37441737)
It's not about hard drive space, it's about start up time.

The 10x LOC (despite being a huge exaggeration) is also the fixed cost, not the marginal cost. You're only forging main loop and includes, not any fundamental complexity.

This is also a funny argument coming from a Go programmer considering that Go trades off conciseness and expressivity for simplicity. Show me some of your favorite Go and I'm sure we can replace it with some concise C++.

Re:Decoded: GNU Coreutils by 38 on Saturday September 09, 2023 @02:22AM (#37442762)
> C++

I just physically shuddered

Re:Decoded: GNU Coreutils by commonlisp94 on Saturday September 09, 2023 @02:47PM (#37448899)
I bet you did.
Re:Decoded: GNU Coreutils by smashed on Saturday September 09, 2023 @12:38AM (#37442341)
This.

In fact, most embedded Linux thingy will be running the busybox version of core utilities instead of gnu coreutils for binary size reasons.

I other words, even gnu coreutils is too big.

Re:Decoded: GNU Coreutils by IshKebab on Saturday September 09, 2023 @08:29AM (#37444550)
Right but that's mostly because it includes its runtime and the C version does not.

It's pretty easy to avoid this problem anyway - just combine multiple tools into one binary like Busybox does.

In any case the simplicity of the Go code is not really related to the binary size.