News for hackers. Stuff that matters.
Re:Zlib-rs is faster than C by nicoburns on Sunday March 16, 2025 @08:24PM (#43383951)
You're a lot more limited more limited to the kinds of APIs you can safely encapsulate in C. For example, you can't safely encapsulate an interface that shares memory between the library and the caller in C. So you're forced into either:

- Exposing an unsafe API and relying on the caller to manually uphold invariants

- Doing things like defensive copying at a performance cost

In many cases Rust gives you the best of both worlds: sharing memory liberally while still having the compiler enforce correctness.

Re:Zlib-rs is faster than C by uecker on Monday March 17, 2025 @04:07PM (#43392262)
Rust is better at this yes, but the practical advantage is not necessarily that huge.