Earlier quoted context omitted.
Rust as a language does not protect against memory leaks - std::mem::forget even explicitly does so. Generally garbage collected languages do, so trading go for rust increases the risk of having memory leaks.
You are invoking std::mem::forget which is explicitly for circumventing destructor execution and then complaining about leaks. Okay. The documentation page for std::mem::forget goes through all the alternatives you should try before resorting to std::mem::forget. Now, perhaps std::mem::forget should be marked unsafe. However, you don't just "accidentally" run std::mem::forget. BTW, one of the problems with GC languag…
Why Discord is switching from Go to Rust (2020)
51–60 of 60 posts
Re: Why Discord is switching from Go to Rust (2020)
#52Earlier quoted context omitted.
They actually would have mitigated it by upgrading their Go version, because the latest release at the time had a fix in the runtime that would have basically solved this. Turns out no one on the team actually looked into issues in the Go repo to see if it was being addressed. Looks like they just wanted to write Rust, which is fine Rust is cool, but let’s not deceive ourselves.
That is not what happened, they did not publish the blog post immediately after the transition, and those changes to the GC did not happen until after the port happened. Some people made assumptions about timeline that were incorrect, and then repeated. The discussion at the time on Reddit [1] mentions this. The general discussion as well talked about if the improvements, which were big in many cases, would have even…
Re: Why Discord is switching from Go to Rust (2020)
#53Earlier quoted context omitted.
That is not what happened, they did not publish the blog post immediately after the transition, and those changes to the GC did not happen until after the port happened. Some people made assumptions about timeline that were incorrect, and then repeated. The discussion at the time on Reddit [1] mentions this. The general discussion as well talked about if the improvements, which were big in many cases, would have even…
The point is that they could have found the issue and seen that it was about to be released. That would be good engineering, bad engineering is when you don't find the root cause of your problem and see if its being worked on
Re: Why Discord is switching from Go to Rust (2020)
#54Earlier quoted context omitted.
I remember when this article came out, everybody was pointing out the fact that they used a go version that was several releases older. Perhaps if the intent wasn't to convince their managers to let them write it in Rust, they would have tried using the latest Go version at the time?
https://news.ycombinator.com/item?id=31021719
Not to mention, the article made no effort to establish that it's describing the world 2 years prior to this being written
Re: Why Discord is switching from Go to Rust (2020)
#55Earlier quoted context omitted.
Hmm, well Go itself has gone through a ton of revisions where the GC saw large improvements. And other languages coming up are experimenting with various types of GCs. Its really up to the use case though. With discord, I imagine a big reason why Rust was considered as an alternative to Go is because they already have a substantial Elixir codebase. Rust and Elixir have a very easy time communicating with one another…
We use Elixir + Rust in a few select places. But the majority of our Rust code is services that are purely written in Rust. We use Rust over Go, not only because of the garbage collection issues, but because it's truly a better language in almost every way (once you learn it!) I will say, Go is much easier to pick up, but in exchange you pay in the long term having a language that actively works against you when you…
I've used both languages extensively. I like both languages. I still reach for golang first because its faster to develop with simply due to the compile times.
Re: Why Discord is switching from Go to Rust (2020)
#56Earlier quoted context omitted.
Where do you get that sense that Rust results in memory leaks? Is that just an assumption you’re making about languages without garbage collection, or are there examples you’re aware of Rust applications having to deal with runaway memory consumption?
Rust as a language does not protect against memory leaks - std::mem::forget even explicitly does so. Generally garbage collected languages do, so trading go for rust increases the risk of having memory leaks.
Leaking in Rust requires either explicit leaking function call, leaking in C/FFI code, or a type that is 1. recursive 2. refcounted 3. with interior mutability, and 4. a programming error in use of such type. If any of these four conditions aren’t met, it can’t leak.
Re: Why Discord is switching from Go to Rust (2020)
#57Earlier quoted context omitted.
I love Rust elixir Nifs. Gives you the best of both worlds to be honest. Highly fault tolerant code with fast computation. Only downside is that it can't really handle extreme crashes like a native process can.
Erlang/Elixir + Rust is an awesome couple. For the downside you mentioned, depending on the use case, it could be interesting to use Rust as a node: https://github.com/sile/erl_dist
Re: Why Discord is switching from Go to Rust (2020)
#58(2020) (Anyone know if they're still using Rust?)
Yes we are using rust in a big way. We have multiple teams now full time working on Rust. It is being used on both the client and server, as native modules, web assembly, and also native rust services and NIFs that embed themselves in our elixir services. It has been an incredible success. I plan to blog more about it in the coming months. Our usage of Rust is continuing to grow, and if you check out our jobs page, y…
Re: Why Discord is switching from Go to Rust (2020)
#59Not saying this is the case here but highly likely.
Re: Why Discord is switching from Go to Rust (2020)
#60Earlier quoted context omitted.
We use Elixir + Rust in a few select places. But the majority of our Rust code is services that are purely written in Rust. We use Rust over Go, not only because of the garbage collection issues, but because it's truly a better language in almost every way (once you learn it!) I will say, Go is much easier to pick up, but in exchange you pay in the long term having a language that actively works against you when you…
all the issues you mention for go literally plague every other language out there except for a very small minority. of which rust is one. its a fair criticism but you're completely disregarding the downside around development speed. I've used both languages extensively. I like both languages. I still reach for golang first because its faster to develop with simply due to the compile times.
Rust vs Go discussions are pretty silly. More folks should think of Rust + Go. There are a lot of glue-services that can take the trade-off of a GC, be magnitudes better than Python, and be maintained by a short-staffed team.
Plus, Rust is still plagued by Python (and others) Async problem — it's easy to accidentally block the event loop. When you have a ton of tiny glue services, esp. if one has a lot of contributors / internal libs, it's an easy mistake. Critical path things are worth the attention to detail. Others... ¯\_(ツ)_/¯