3 ms·
In what sense does rust not expose the full power of the processor to the user? Can you give a concrete example? > Just be mindful, and run a couple of valgrin
by andrepd 3y ago
In what sense does rust not expose the full power of the processor to the user? Can you give a concrete example?
> Just be mindful, and run a couple of valgrind tests on your code, and you're set.
Thousands of severe CVEs every year attest to the effectiveness of that mindset. "Just git gud" is not a meaningful thing to say, as even experienced devs routinely make exploitable (and other) mistakes.
- bayindirh 3y agoRust probably won’t allow me to implement a couple of lockless parallel algorithms I have implemented in my Ph.D., which are working on small matrices (3K by 3K). These algorithms allow any number of CPUs do the required processing without waiting for each other, and with no possibility of stepping on each other, by design. In the tests, it became evident that the speed of the code is limited by the memory bandwidth of the system, yet for the processors I work with that limit is also very near to practical performance limit of the FPUs, as well. I could have squeezed a bit more performance by reordering the matrices to abuse prefetcher better, but it was good enough (~30x faster than the naive implementation with better accuracy) and I had no time. Well, the method I verify the said codebase is here [0]. Also, if BSD guys can write secure code with C, everybody can. I think their buffer overflow error count is still <10 after all these years. [0]: https://news.ycombinator.com/item?id=31218757 https://news.ycombinator.com/item?id=31218757
- vlovich123 3y ago> Rust probably won’t allow me to implement a couple of lockless parallel algorithms I have implemented in my Ph.D., which are working on small matrices (3K by 3K) That’s a bold claim to make without evidence. Things like that totally seem doable in Rust without a lot of ceremony. You might have to launder some lifetimes through unsafe if you can’t convince the compiler statically, but that’s not that hard. > Also, if BSD guys can write secure code with C, everybody can. I think their buffer overflow error count is still <10 after all these years. As was the problem with Linux enthusiasts claiming Linux was safer bedside fewer CVEs, BSD similarly benefits from having almost no attention paid to it + very few core developers so the feature growth rate is minimal. I don’t but the claim that BSD’s qualities extrapolate anywhere rather than a more mundane explanation or that BSD is the exception that proves the role somehow given no other successful project seems to be able to do the same.
- deleted 3y ago[deleted]
- bayindirh 3y agoI would happily give it a try, when I have some time on the side. But that day is not today, unfortunately. > I don’t but the claim that BSD’s qualities extrapolate anywhere rather than a more mundane explanation or that BSD is the exception that proves the role somehow given no other successful project seems to be able to do the same. It's mostly about "it's done when it's done" mentality and always putting the discipline before writing code fast. It's a vastly different mentality when compared to modern, conventional software development. This mentality also makes what Debian is Debian. On the other end of the spectrum, we have the stressed solo developer syndrome, which brings us OpenSSL with its all problems and grievances.
- deleted 3y ago[deleted]
- kouteiheika 3y ago> Rust probably won’t allow me to implement a couple of lockless parallel algorithms I have implemented in my Ph.D. Why? Can you be more specific? Rust has built-in support for atomics and essentially the same memory model as C++, e.g.: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU32.html https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU32.h... And you can sidestep essentially any requirements of normal Rust using an `UnsafeCell` (e.g. that's how mutexes are implemented, with an `UnsafeCell` holding the data and an atomic). I've written my share of lockless algorithms and I haven't really noticed any deficiency compared to C++, but then, I'm not an expert in this area, so if there is a deficiency here I'd love to hear about it.