from Hacker News

Why Discord is switching from Go to Rust (2020)

by hiena03 on 4/13/22, 7:38 PM with 59 comments

  • by technological on 4/13/22, 8:09 PM

  • by verdagon on 4/13/22, 8:38 PM

    I suspect that GC'd languages could mitigate this problem by introducing regions; separate areas of memory that cannot point at each other. Pony actors [0] have them, and Cone [1] and Vale [2] are trying new things with them.

    If golang had this, then it might not ever need to run its GC because it could just fire up a new region for every request. The request will likely end and blast away its memory before it needs to collect, or it could choose to collect only when that particular goroutine/region is blocked.

    Extra benefit: if there's an error in one region, we can blast it away and the rest of the program continues!

    [0] https://tutorial.ponylang.io/types/actors.html#concurrent

    [1] https://cone.jondgoodwin.com/fast.html

    [2] https://verdagon.dev/blog/seamless-fearless-structured-concu...

  • by erikbye on 4/13/22, 8:22 PM

    Not discrediting Rust, but I've noticed you rarely hear "we improved performance" by rewriting our implementation using the same language... Although this, too, can yield similar performance improvements.
  • by pfraze on 4/13/22, 8:17 PM

    I’m told the Go GC has gotten better in recent years. Has anybody run a similar program in Go lately that can confirm that?
  • by phendrenad2 on 4/13/22, 7:39 PM

    (2020)

    (Anyone know if they're still using Rust?)

  • by mc4ndr3 on 4/13/22, 8:26 PM

    How illuminating. From CloudFlare posts, I had been under the impression that Go's gc was incredibly unintrusive, near-real time performance for applications operating in increments of a few hundred milliseconds. For example, CloudFlare uses Go to analyze network traffic.

    Yes, Rust provides a more predictable, faster memory management model than Go. At the expense of unpredictable, expensive memory leaks triggering application termination.

    Curious how much time and effort was dedicated to improving gc, which is a useful endeavor in its own right.

  • by alberth on 4/13/22, 8:07 PM

    Isn’t this a function of them being such heavy Erlang users and are writing NIFs (via Rustler) in Rust.
  • by midrus on 4/16/22, 2:11 PM

    Or they just got bored and wanted to try some shinier toy. I've seen this happen dozens of time, all the bullshit for justifying it is just that, bullshit.

    Not saying this is the case here but highly likely.

  • by butterisgood on 4/13/22, 8:53 PM

    Well... is this still true? Go's had a lot of perf improvements in the last two years.
  • by sys_64738 on 4/13/22, 10:56 PM

    C with coroutines?
  • by loudtieblahblah on 4/13/22, 9:11 PM

    meh. I'm switching from Discord to Guilded.
  • by boxingrock on 4/13/22, 8:27 PM

    isn't the tldr on this that Go let them scale up for years before it became the bottleneck? a natural progression for any successful project...