• Blaster M@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 day ago

    They’ll fix it… sounds like a skill issue, if base64 got fixed and performs better than c

    • chocrates@piefed.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      22 hours ago

      I’ve heard that while Rust has the ability to be faster than Go and maybe C, it is a lot harder to write rust code to do it

      • ulterno@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        15 hours ago

        Well, you need to type more and you need to learn more things with Rust, before you can start making stuff.
        But the additional work is to make it easier for you to make changes later, when you come back to it after a while.

        So you might need to do more before hello world, but say if you have a complex library and want to use some function of it after learning Rust, it will be easier to not make some common mistakes.

        A pretty good recent example of something that will cause a common mistake would be:
        In the mongoc library, there is a function named mongoc_client_select_server and the pointer it returns requires destruction using mongoc_server_description_destroy. But it doesn’t say so in the function’s comments/documentation. So, I had to go into the function called by the function called by the function called by it, to find the function making said pointer and having a comment stating that the pointer made by it would require destruction by the user.
        And the only reason I found that out was my obsession, but I had already made the mistake.

      • trevor (he/they)@lemmy.blahaj.zone
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        20 hours ago

        This is not true. If you know Rust and C equally well, you’re likely go write equally performant Rust.

        You could say that Rust is harder to learn than C. I’d disagree based on my personal experience, but you wouldn’t be wrong.

        • PlexSheep@infosec.pub
          link
          fedilink
          arrow-up
          0
          ·
          3 hours ago

          I have read papers for my bachelor’s thesis that compared rust and c on x86-64 in terms of performance. It showed that C is a little or significantly faster, depending on the type of workload.

          This is likely due to some runtime checks the rust compiler adds, and modified rust compilers that added less runtime checks led to about the same performance.

          However, the performance is still very good for both languages (native machine code being executed), and in the same order of magnitude.

          My own measurements for the armv6m architecture with an STM-32 showed that rust may even be faster in some cases, since the optimizing of the rust compiler was better, at least for that setup and for the CRC-32 algorithm.