> The end result is a memory-safe video decoder that runs 2.7x faster than the Rust port, with identical video output, bringing it closer to the optimized C++.
So ... Rust still can't beat the C++ implementation :-D
Sorry, didn't mean to ignite a langwar, but it's still interesting to see.
Additional safety checks do mean less performance, it's the same thing as hardened allocators. Rust will panic if for some reason you attempt to read outside the bounds of a slice object (even when it should be impossible to be outside those bounds)
If it's "rust still can't beat... performance-wise", then yeah I guess.
But there are other criteria. The move to rust might've also resolved numerous potential memory-safety bugs in the decoder.
"Safe Rust" being closer to "optimized C++". And those "optimized C++" usually incldues assembly code, so it's a huge improvement.
Of course, Rust is not a magic, so just porting to Rust wouldn't make this performance improvement. It seems their AI overfitted code to Rust compiler to find safe Rust code that compiles to efficient assembly.