4 ms·
You're switching to Rust because Go is too slow? Colour me sceptical, but this seems more like an excuse to adopt a trendy language than a considered technical
by romaniitedomum 7y ago
You're switching to Rust because Go is too slow? Colour me sceptical, but this seems more like an excuse to adopt a trendy language than a considered technical decision. Rust is designed first and foremost for memory safety, and it sacrifices a lot of developer time to achieve this, so if memory safety isn't high in your list of concerns Rust is probably not going to bring many benefits.
- hajile 7y agoDid you read the article? The naive Rust version was better than the tuned golang version in every metric. The most important one (latency) simply wasn't fixable due to golang's GC (something that is a bit of a general GC issue I might add).
- romaniitedomum 7y agoDid you read my comment? I don't dispute that the Rust version is faster in every way. I am disputing that rewriting in Rust was a sensible technical decision, and in support of this I point you to where the author describes having to use a nightly build of the compiler to get async support. Given that they had to jump through a lot of hoops to make this work, I am saying they could have achieved the same speed increase with less effort using a stable C or C++ compiler. Hell, had they invested a fraction of the time spent rewriting in Rust in the Go version, I'll bet they could have improved it to the point where there was no need to rewrite it at all. It's clear that Discord use Rust a lot, and that they are looking for any excuse to replace existing code with Rust code.
- smabie 7y agoWhat would you recommend that doesn’t have a GC? Zig? C? Rust is a fine choice. Besides if you really don’t care, just make the entire program unsafe and you’ll still reap benefits over C or C++.
- romaniitedomum 7y agoWhatever language and toolset gets the job done with the least amount of effort. Given the hoops that Discourse had to jump through to get Rust working, that wasn't a good technical decision. They'd have got the same result with less pain with C++.
- damnyou 7y agoThe costs of any long-lived service are dominated by ongoing maintenance, not the initial work.
- iruoy 7y agoSo decreasing workload on the servers and avoiding spikes in the read states queue is bad business? The article also states that is was quite easy to port over and didn't need any quirky tuning.
- lllr_finger 7y agoThe goals of Rust are stated boldly right on the official website - "Performance" is one of them. In Discord's case, the hit in productivity was worth avoiding the GC issues in Go. I read the article and didn't come to the same conclusion, so I'm curious which passages led you to believe this was done to "adopt a trendy language"?
- romaniitedomum 7y agoPerformance is not the core raison d'etre of Rust, and there are no shortage of testimonials to the difficulty new developers have with it, not to mention the slowness of its compiler. Given that, it's too much of a leap for me to get from "GC is too slow in Go" to "rewrite in Rust", at least when considered as a purely technical decision. There is no mention, for instance, of what other languages were considered. My guess is none were considered. Finally, the author states that Discord pride themselves in embracing new things, and cites having to work with the nightly build of the compiler to get async. All of this tells me that they chose Rust for non-technical reasons and were prepared to jump through all kinds of hoops to make it work. Which is fine, it's their business to run however they want, but I find the premise that Rust is an obvious choice for speed entirely unpersuasive. In most businesses, introducing unstable nightly builds of compilers to build production services would be a major red flag.
- anon4242 7y agoTurns out that that boring stuff - type theory - they throw at you in uni, can be quite useful. Not only can it help with things like memory safety but also with speed. This is why for instance C++ std::sort() is faster than C qsort(), better type information available to the compiler allows it to make better optimizations. In rust the type system is king.
- romaniitedomum 7y agoNo, in Ada the type system is king. If type theory is the solution, then Ada and SPARK, Ada's restricted subset for extra safety, leave Rust in the dust.