Garbage collection and the underappreciated power of good enough

October 15, 2018

Today I read The success of Go heralds that of Rust (via). In it the author argues that Rust is poised to take over from Go because Rust is a more powerful language environment. As one of their arguments against Go, the author says:

All the remaining issues with Go stem from three design choices:

  • It’s garbage collected, rather than having compile time defined lifetimes for all its resources. This harms performance, removes useful concepts (like move semantics and destructors) and makes compile-time error checking less powerful.

[...]

Fix those things, and Go essentially becomes the language of the future. [...]

I think the author is going to be disappointed about what happens next, because in my opinion they've missed something important about how people use programming languages and what matters to people.

To put it simply, good garbage collection is good enough in practice for almost everyone and it's a lot easier than the fully correct way of carefully implementing lifetimes for all resources. And Go has good garbage collection, because the Go people considered it a critical issue and spent a lot of resources on it. This means that Go's garbage collection is not an issue in practice for most people, regardless of what the author thinks, and thus that Rust's compile time defined lifetimes are not a compelling advantage for Rust that will draw many current (or future) Go users from Go to Rust.

There are people who need the guarantees and minimal memory usage that lifetimes for memory gives you, and there are programs that blow up under any particular garbage collection scheme. But most people do not have such needs or such programs. Most programs are perfectly fine with using some more memory than they strictly need and spending some more CPU time on garbage collection, and most people are fine with this because they have other priorities than making their programs run as fast and with as minimal resource use as possible.

(These people are not being 'lazy'. They are optimizing what matters to them in their particular environment, which may well be things like speed to deployment.)

The underappreciated power of 'good enough' is that good enough is sufficient for most people and most programs; really, it's almost always sufficient. People don't always stop at good enough, but they often do, especially when achieving better than good enough is significantly harder. This is not a new thing and we have seen this over and over again in programming languages; just look at how people have flocked to Perl, Python, PHP, Ruby, and JavaScript, despite there being more powerful alternatives.

(Good enough changes over time and over scale. What is good enough at small scale is not good enough at larger scale, but many times you never need to handle that larger scale.)

What matters to most people most of the time is not perfection, it is good enough. They may go beyond that, but you should not count on it, and especially you should not count on perfection pulling lots of people away from good enough. We have plenty of proof that it doesn't.


Comments on this page:

Thought experiment: the main difficulty in writing Rust is the lifetime analysis and the borrow checker. Those are also its raison d’être, and if that difficulty were to somehow be solved, would the result still be Rust? The closest thing I can think of to “less strict Rust” would be OCaml or F#.

Whereas “Go with generics” is still Go, and creating it is a far smaller jump.

(I know that’s a dead horse, but I’ve been programming in dynamic languages for 15 years, and coding in Go—like Rust—is difficult enough to make me ask, “Is there really a point to me getting good at this?”)

By Greg A. Woods at 2018-10-19 21:07:04:

I can't imagine any experienced Go programmer ever moving over to use Rust for any reason whatsoever.

Unless maybe they are really C++ fans and they've only been forced to use Go to earn a living, or some such.

By Juillaird at 2018-10-21 11:54:28:

The 90's called and want their "Worse is better" back.

Written on 15 October 2018.
« Getting a CPU utilization breakdown in Prometheus's query language, PromQL
The external delivery delays we see on our central mail machine »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Oct 15 00:06:10 2018
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.