this post was submitted on 15 Sep 2025
82 points (97.7% liked)

Linux

9445 readers
400 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Blaster_M@lemmy.world 16 points 4 days ago (2 children)

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

[–] sga@piefed.social 9 points 3 days ago

a pull request has been made, and already merged.

[–] chocrates@piefed.world -1 points 3 days ago (2 children)

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

[–] trevor@lemmy.blahaj.zone 15 points 3 days ago* (last edited 3 days ago) (1 children)

This is not true. If you know Rust and C equally well, you're likely going to 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 4 points 3 days ago (1 children)

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.

[–] trevor@lemmy.blahaj.zone 2 points 2 days ago* (last edited 2 days ago) (2 children)

Unless you're talking about some sort of reference counting, which has to be explicitly added by the programmer in cases where doing so is required for memory safety, I'm not sure what runtime checks you're referring to?

From what I've seen, the performance of programs written in C and Rust are generally the same, more or less, with C or Rust coming out on top with roughly coinflip odds in a handful of cases. This feels like the primary differentiator in performance really comes down to the implementation of the person writing it, and less to do with any performance differences inherent to either language.

[–] PlexSheep@infosec.pub 5 points 2 days ago* (last edited 2 days ago) (1 children)

I found the study: https://doi.org/10.1145/3551349.3559494

It's open access, short, and really well written. Was a primary source of my bachelor's thesis.

Figure 2 for the lazy people:

The results of this study suggest that rust programs can be a bit slower, or nearly match the performance of C programs on x86-64, and that the runtime checks play a big role in this dynamic.

[–] trevor@lemmy.blahaj.zone 1 points 3 hours ago

Thanks for sharing! Bounds checks are a fair critique. The Rust Performance Book suggests that bounds checking has little performance impact compared to many other factors that you could optimize out, but it's certainly not zero performance impact, as I initially claimed.

[–] PlexSheep@infosec.pub 1 points 2 days ago

It's things like out of bounds checking. I'll go look for the paper and make another reply.

[–] ulterno@programming.dev 6 points 3 days 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.