• Luci@lemmy.ca
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    18 days ago

    Rust running slower than C?

    Never would have guessed……

    Edit: LMAO

        • trevor (he/they)@lemmy.blahaj.zone
          link
          fedilink
          English
          arrow-up
          8
          ·
          19 days ago

          I have no idea how. I write better Rust than I do C 🤷‍♂️

          Rust and C are basically identical in terms of performance (more or less). Idk where the myth that Rust is somehow less performant than C came from.

        • LeFantome@programming.dev
          link
          fedilink
          arrow-up
          5
          ·
          edit-2
          19 days ago

          think it’s fair to say performance rust is hard to write

          This situation proved exactly the opposite.

          They wrote a utility to pass functional tests. It did. Then people said it was too slow. So, in just a few days or hours, they dramatically sped it up while still passing the tests.

          Seems like it was pretty easy to write fast Rust code in this case.

          • chocrates@piefed.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            18 days ago

            Fair point. I am mostly going on what I have seen others do on streams when comparing rust and go. Go seemed faster to get good performance and rust sometimes had to write a ton of code to get the same performance.

            I don’t know if you can selectively not use Go’s garbage collector, but that seems to be the only reason Go might be theoretically slower than rust.

    • LeFantome@programming.dev
      link
      fedilink
      arrow-up
      9
      ·
      edit-2
      19 days ago

      The best thing about all the C smugness here is how quickly it backfired.

      Out of dozens of utilities in uutils, two were slower than the GNU equivalents. In case the logic escapes some, that means that the others were already as fast or faster. Some are multiples faster. The overall uutils suite is faster then GNU Coreutils already and will only get better. There was nothing for C fans to be smug about to begin with.

      Of the two that were slower, it seems to have only taken a few days to make them faster. The article only tells us about one which is now 50% faster than the GNU version.

      But the promise of Rust is not that Rust is faster anyway. It is that it is easier and safer to refactor. The actual promise of Rust is that you can address issues like performance without as much fear that you will break everything.

      After the reported slowness, both of the two uutils implementations were dramatically sped up in just a couple of days or even hours. They are tested against the GNU test suite and so we know these tests are still passing. That is the promise of Rust. This example proves the Rust claims real. The C smugness did not age well.

      The C versions (GNU) can clearly be sped up as well. The question is who will do that and when. Because speeding up old C code is not nearly as easy or fun. My guess is that it is going to be more than a couple days before we see headlines bragging that GNU has caught up.

      The GNU Coreutils are maintained by Red Hat if we look at who contributes the code and who maintains the dev servers. They are professionally maintained. It is not a rag tag bunch of amateurs. So if uutils is already faster, it does not bode well for the C implementation.

      • Samueru_sama@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        18 days ago

        The overall uutils suite is faster then GNU Coreutils already and will only get better

        just did a quick benchmark.

        uutils cat is 2x slower.

        This is the unknown-linux-gnu release, the musl one is likely slower but didn’t check.