Zlib-Rs Is Not Only Safer but Now Outperforming Zlib C Implementations

by mrpotatoon 2/25/2025, 1:15 PMwith 17 comments

by bennettnate5on 2/25/2025, 2:45 PM

Fascinating--I wonder to what extent the performance improvements are due to the better constraints Rust hands over to LLVM for optimization (specifically thinking `noalias` rules) vs aggressiv code optimization by the developers to be to the point where they beat the C zlib. The latter could be more difficult to achieve given how long the original zlib has been getting incrementally improved, though.

by giancarlostoroon 2/25/2025, 2:23 PM

Really interesting, I've never used the Rust version, I can only assume I've used the C implementation indirectly dozens of times if not hundreds, but does anyone know how 1:1 the Rust implementation is?

The one area where C will always beat Rust (at least today) will probably always be portability, C compilers run everywhere, on everything, and to anything... Unless Rust has similar capabilities via LLVM?

by agentultraon 2/25/2025, 2:50 PM

Are they exporting their library with the C-ABI? It's cool if it's fast and would be nice if I could link to it from non-Rust code.