Discord Switching From Go To Rust

Came across this blog post <https://blog.discordapp.com/why-discord-is-switching-from-go-to-rust-a190bbca2b1f> explaining why Discord, which has been using Google’s Go language to implement its services, has now decided to rewrite them in Mozilla’s Rust. The problem was garbage collection. Go has a similar memory-allocation model to Java or LISP, where you can create objects and simply forget about them when you don’t need them any more, and a background process will automatically reclaim the storage at some point. The trouble is, that reclamation process (the “garbage collector”) tends to be the source of performance bottlenecks in the system. Not to mention that the memory usage of your program can grow to fill all available space, unless you impose arbitrary limits on it. Languages like Perl and Python use a hybrid model, where objects have reference counts attached to them, keeping track of how many other objects or variables still point to them, so they can be automatically freed when the count goes to zero. There are cases where this isn’t enough, and in those cases a full garbage-collection process kicks in. One benefit that I certainly observe with this is that memory usage for a program can remain reasonable, even after it has been running for a long time. Rust avoids the whole issue in a clever way, by having the compiler enforce memory-ownership restrictions in the language itself, so memory can be correctly allocated and freed without resorting to a garbage collector. The result is that Rust can achieve significantly higher performance than Go, while avoiding most of the attendant risks of dumping the whole responsibility for memory management on the programmer, as is done in languages like C++ and C.

On Fri, 7 Feb 2020 13:27:25 +1300, I wrote:
Came across this blog post <https://blog.discordapp.com/why-discord-is-switching-from-go-to-rust-a190bbca2b1f> explaining why Discord, which has been using Google’s Go language to implement its services, has now decided to rewrite them in Mozilla’s Rust.
Here’s another update on the adoption of Go <https://www.theregister.co.uk/2020/04/21/go_developers_want_generics_easier/>. It ends with an interesting note on Google’s use of its own programming language for development of its own OS: "The Fuchsia Platform Source Tree has had negative implementation experience using Go. The system components the Fuchsia project has built in Go have used more memory and kernel resources than their counterparts (or replacements) the Fuchsia project has built using C++ or Rust," said the team. This is despite wide familiarity with Go among those building Fuchsia. The implication is that while Go may be great for developing APIs and web services, it is not so good at the lowest level, perhaps a price paid for developer-friendly features like garbage collection. Even Google is discovering that Rust works better when performance matters ...
participants (1)
-
Lawrence D'Oliveiro