4 ms·
In Rust it’s easier to leverage external crates/libraries that are more optimised than rolling your own. This can lead to performance increases (I don’t know if
by joshlk 3y ago
In Rust it’s easier to leverage external crates/libraries that are more optimised than rolling your own. This can lead to performance increases
(I don’t know if fish is doing this)
- starcraft2wol 3y agoC programs without libraries tend to be really fast for the opposite reason. So this isn’t persuasive even though it seems like it should be true
- acdha 3y agoThis is only true for very simple single-threaded code. Once you’re doing anything the compiler can’t trivially optimize, you’re using libraries, getting left far behind by the Rust program, or both.
- starcraft2wol 3y agoSince most industrial software is in C and C++ an example would be more convincing. > doing anything the compiler can’t trivially optimize What does compiler optimization have to do with libraries? > single threaded Plenty of C and C++ programs are multi threading using a system api like pthreads.
- acdha 3y ago> Since most industrial software is in C and C++ an example would be more convincing. Agreed- do you have any to back up your original claim? > > doing anything the compiler can’t trivially optimize > What does compiler optimization have to do with libraries? One of the most common reasons to use a library is because it has optimizations you want to use. For example, performance-sensitive programs link against OpenSSL even if they’re just using a couple of hash functions because the SHA-256 function you copied into your codebase won’t have their assembly backend or use of processor intrinsics. Repeat for string searches, pattern matching, all kinds of math, etc. where people have written libraries with pricessor-specific assembly, SIMD intrinsics, etc. > Plenty of C and C++ programs are multi threading using a system api like pthreads. Yes - and the long history of bugs related to that is why many stayed single-threaded because it was more work than the author had time for to make the code thread-safe. Rust’s “fearless concurrency” talk isn’t just marketing but a reaction by people with a lot of experience in the area realizing just how much more they used concurrency when it was easy to do correctly rather than infamously hard.
- starcraft2wol 3y ago> examples Linux, Maya, Photoshop, Chrome > OpenSSL When C programmers do crypto they also use OpenSSL, but more for security than performance. Do you have an example of a rust library which is a better substitute for commonly hand written C? > fearless concurrency Not related to the topic of discussion about performance gains of using libraries.
- bayindirh 3y agoI have never experienced difficulties adding high (HPC level) performance libraries into my code. Can you elaborate?
- dwattttt 3y agoIt definitely makes a difference around threading; exposing thread safety in function API makes it easy to understand where/how you can add threading support, or what is preventing it.