from
https://www.memorysafety.org/blog/rav1d-performance-optimiza...rav1d is transpiled c-to-rust version of dav1d, compiled using Clang18 for dav1d and relevant Clang18-LLVM backend code for rustc.
Measurements showed rav1d was 3.8% slower than dav1d. Hacking up a rustc to turn off bounds checking showed rav1d-no-bounds-check was 3% slower than dav1d.
So rustc bounds checking resulted in <1% total slowdown from dav1d.
Another theory about slowdown was due to overflow checking with signed arithmetic. Further tests showed only isolated incidents of slowdown due to overflow arithmetic checking.
According to perf counters, rav1d executed 7% more instructions than dav1d. Approximately 2% of 7% is due to bounds checking.
More info about subtle interactions with changing transpiled code to idiomatic Rust in the article.
"After applying the optimization techniques discussed here (and more), we have reduced performance overhead from a peak of about 11% when we started optimizing the safe Rust implementation in earnest to under 6% now on x86_64. We believe there is still room for further improvement, both in how the compiler optimizes Rust and in our implementation details. This will necessarily be a process of small, incremental improvements, as our profiling now indicates that the remaining overhead is spread roughly evenly across the largest, most complex functions in rav1d."