Rust-Written Zlib-rs Is Not Only Safer But Now Outperforming Zlib C Implementations
Rust-Written Zlib-rs Is Not Only Safer But Now Outperforming Zlib C Implementations
www.phoronix.com
Attention Required! | Cloudflare
Rust-Written Zlib-rs Is Not Only Safer But Now Outperforming Zlib C Implementations
Attention Required! | Cloudflare
Phoronix comments really are a battlefield for rust vs C. The seaheads just can't accept rust is safer and will moan about the borrow checker telling them they are doing something unsafe. Probably the same people would argue static typing is better then dynamic typing, but can't seem to see the parallels between safety guarantees at compilation time vs checking at runtime. Impressive.
More to zlib-rs: good job! RiR without bothering people is great. Just do it.
Anti Commercial-AI license
They talk too much. But almost none of them actually code or know how to at a good level.
We have someone just like that here.
There has been a zlib in Ada for many years, doing its job quietly. Speed comparable to the C version, probably not beating it, but not trailing by much in any case. Rust is safer than C but less safe than Ada from what I can tell.
Rust (edited for clarity) looks to me to be about halfway between C and C++ in complexity, with a bunch of footguns removed, and using implicit move semantics ("borrowing") more than C++ does, and the notorious borrow checker is simply the compiler making sure you don't make RAII mistakes because of that.
It's always seemed to me that Phoronix is too often about turning mailing list drama into clickbait. I've mostly disliked it, because of that.
I don't know much about Ada, but to my knowledge, its safety is difficult to compare with Rust.
Ada has a type system that can express lots of details (like that an hour is in the range from 0 to 23), but then Rust prevents you from doing dumb things across threads (which might be part of the reason why a faster implementation was so quick to be implemented) and Rust has a more functional style, which also tends to avoid various bugs.
And then, yeah, kind of similar thing for C/C++.
If we just score the complexity and then compare numbers, I can see how you might arrive at the halfway mark. (Not knowing terribly much about C++ either, having so many legacy concepts feels incredibly daunting, so I'd put Rust rather at a third of the complexity points, but either is fair.)
But yeah, on the other hand, I would not say that Rust is as if C and C++ had a baby with some footguns removed.
C is a hardcore procedural language (aside from the ternary operator). I have to assume that C++ introduced some functional concepts at some point in its history, but Rust is much more oriented in that direction as a whole.
I also believe your description of the borrow checker simply preventing RAII mistakes is a bit too simple. As I already mentioned, Rust also prevents you from doing dumb things across threads.
It does so by the borrow checker checking that you only have one mutable reference at a time ("mutable reference" meaning the holder can modify the value behind the pointer). It also prevents having non-mutable references while a mutable reference is being passed around. If you actually need mutable access accross threads, it forces you to use a mutex or similar.
And yeah, the borrow checker being such an integral aspect, I'd also argue that it has other effects. In particular, it really pushes you to make your program tree-shaped, so where data is initialized at the top of a (sub-)tree and then the data is only temporarily passed down into functions as references.
IMHO that's generally a good idea for making programs understable, but it's a wild departure from the object-oriented world, for example, where everyone and everything just holds references to each other. (You can also do such references in Rust, if you need it, via
Rc
andArc
, but it's not the first tool you reach for.)I am struggling to understand why you are getting downvoted.
I mean... It depends. But in my work (buy side finance) - duh.
Yeah, offer something better instead of just whining in the issue tracker.
I've been considering RiR for some self-hosted stuff (looking at Seafile), and that's totally the approach I'd take: build it better and attract people to the project. I certainly wouldn't shill it until it could stand on its own.
Not all software needs to be ported to something else, but I'll certainly take a project with better security and performance over the OG.