Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming

Why Discord Is Switching From Go To Rust 256

RoccamOccam writes: The developers at Discord have seen success with Rust on their video encoding pipeline for Go Live and on their Elixir NIFs' server. Recently, they penned a post explaining how they have drastically improved the performance of a service by switching its implementation from Go to Rust.

From the post, "Remarkably, we had only put very basic thought into optimization as the Rust version was written. Even with just basic optimization, Rust was able to outperform the hyper hand-tuned Go version. This is a huge testament to how easy it is to write efficient programs with Rust compared to the deep dive we had to do with Go."
This discussion has been archived. No new comments can be posted.

Why Discord Is Switching From Go To Rust

Comments Filter:
  • Spoiler (Score:4, Insightful)

    by Anonymous Coward on Wednesday February 24, 2021 @05:02PM (#61097160)

    No GC with rust.

  • Old news (Score:5, Informative)

    by Kohenkatz ( 1166461 ) on Wednesday February 24, 2021 @05:12PM (#61097192) Journal
    If this looks familiar, it's because it was first posted over a year ago.
    • Re:Old news (Score:4, Interesting)

      by RoccamOccam ( 953524 ) on Wednesday February 24, 2021 @05:21PM (#61097218)
      Yes, this is my mistake. I saw a re-post of the article and didn't realize that it was about a year old until after I had submitted it here.
      • Re:Old news (Score:5, Funny)

        by alvinrod ( 889928 ) on Wednesday February 24, 2021 @06:16PM (#61097402)
        Don't feel bad. It isn't like the editors noticed either. See if you can sneak something even older past them next time.
        • Re:Old news (Score:5, Funny)

          by 93 Escort Wagon ( 326346 ) on Wednesday February 24, 2021 @07:41PM (#61097588)

          Did you hear what CmdrTaco said about the iPod? I think that'd make a great Slashdot submission!

        • IBM Releases Computer System With Solid Logic Technology

          IBM [ibm.com] introduces custom hybrid circuits using discrete, flip chip-mounted, glass-encapsulated transistors and diodes, with silk screened resistors on a ceramic substrate, forming a Solid Logic Technology (SLT) module. SLT sports much higher circuit densities and improved reliability over packaging techniques such as the Standard Modular System. SLT research produces ball chip assembly, wafer bumping, trimmed thick film resistors, printed discrete func
          • It'll never catch on. Go old tried and tested vacuum tubes are what the real computers are using and will continue to use long after this solid-state fad fades away.

        • by AmiMoJo ( 196126 )

          My theory is that this happens because the search function is so bad. If you want to know what searching the internet was like in 1999, try the Slashdot search box.

          The formatting of the site makes it difficult to find what you want with Google too.

  • Old version of Go (Score:4, Informative)

    by Gumshoe ( 191490 ) on Wednesday February 24, 2021 @05:24PM (#61097224) Journal
    This is quite an old article.

    Discord were using Go v1.9.2 which was two years old at the time of this post (Feb 2020). So they were comparing an old version of a language with the bleeding edge of another language.

    All power to them, Rust is a fine language, but it seems strange to me that they never bothered trying the latest version of Go before putting the effort into porting to a new language.

    FWIW, Go's performance since v1.9 has improved dramatically. And there are performance improvements which will hopefully be added in the next version later this year (register based arguments and return values, as opposed to stack based)
    • In addition to various misc improvements, Go 1.14 added support for asynchronous preemption of goroutines. Before that the GC had to wait until all goroutines stop at safepoints, which could take quite a bit of time if they are were stuck in tight loops. Now GC can just stop all goroutines and start collecting within 1 ms.

      There's a good Gophercon presentation about it: https://www.gophercon.com/agen... [gophercon.com]
  • Apples and Oranges (Score:5, Insightful)

    by Going_Digital ( 1485615 ) on Wednesday February 24, 2021 @05:34PM (#61097280)
    Go is a relatively easy language to learn and is great for rapid development. It is a compiled language but compiles so quickly that it is very much like using an inturceted language. It is a great replacement for languages like PHP and Python, where you want better performance but still relatively shallow learning curve.

    Rust on the other hand is a lower level language, it has a steeper learning curve and the development process will typically take longer than Go. It is intended to replace other relatively low level compiled languages like C++.

    So there is no one size fits all, if your project has no performance goals then simply use something like python that has an enormous library for anything you can possibly imagine and is really easy to get started with. If you need better performance and your application is a command line tool, web application or a faceless api, Go is a good fit, and will bring with it better performance than most interpreted languages. If you want top performance then use C or Rust.

    It is the old maxim of choosing the right tool for the job, not that one tool is better than another. Some projects the speed to market is the most important factor, for others like a video encoder with millions of streams, performance is going to be king. Stop hating on other languages and just use what is most appropriate for the task in hand.

    • by godrik ( 1287354 )

      I actually find that Julia is a great language to replace python in most data mining kind of applications.

      • I like the general idea of Julia, but I think it has made too many poor choices trying to adopt the users of maple, matlab, mathematica, ... the world didnt need another language with a thousand cryptic operators trying to be equal to the notation of mathematicians but only succeeding in being terse and cryptic, and it sure as hell looks like Julia has dived right into that also.
      • > I actually find that Julia is a great language to replace python in most data mining kind of applications.

        Have the concurrency PR's landed in a shipped version? I tried to use Julia for a project a couple years ago but the most it could do was tasks on one OS thread (outside of MPI, which is a totally separate feature).

    • by jma05 ( 897351 )

      The trouble with Go for me is that it is a step back in almost every respect with regards to expressiveness.
      Gophers think that's a feature. I don't.
      I'd pick GraalVM over Go.

      • Expressivity is there, brevity is not. Sometimes people are too clever when they write code, and the rest of the world doesn't have time to decipher the proof of cleverness block.
        Write simple dumb plain ordinary code. Then most of the bugs you face will be simple dumb plain and ordinary.

  • by rsilvergun ( 571051 ) on Wednesday February 24, 2021 @06:09PM (#61097384)
    why does everyone want me on their Discord server? Do they get paid by the user or something?
    • Re: (Score:3, Funny)

      by Anonymous Coward

      why does everyone want me on their Discord server?

      So you'll post less on Slashdot?

    • by godrik ( 1287354 )

      No they don't get paid. There are a couple of reasons I suppose:

      1/ Some people really find the tool helpful. I have been using discord to teach classes, to run a research group, to run professional training workshops. It is pretty nice. I suppose not necessarily different from things like MS teams or combination of slack+zoom, or things like that.

      2/ It is pretty popular among the young and they always seem to be trying to build a community around themselves. That leads to a bunch of "I created a discord on

    • > why does everyone want me on their Discord server? Do they get paid by the user or something?

      A few I've seen have been people who were afraid of getting nuked from YouTube and Twitter. Then they got nuked from YouTube and Twitter.

      THEN Discord started nuking people.

      WHICH CENTRALIZED SERVICE SHOULD WE ALL GO TO NEXT?

      Sheesh. It's like everybody still wants to be a mod on CompuServe.

  • And boy, do those screws go right on in without any of that labor intensive hammering we had to do before! Fuck hammers, they suck!
  • by Retired ICS ( 6159680 ) on Thursday February 25, 2021 @03:09AM (#61098196)

    C has one letter
    Go has 2 letters
    Rust has 4 letters
    Fortran has 7 letters

    That means that Go is twice as good as C, and that Rust is twice as good again. If you want something almost twice as good as Rust, you will switch to FORTRAN. Of course, BASIC is about half way between the goodness of Go and Rust ...

Avoid strange women and temporary variables.

Working...