Hasty Briefsbeta

Bilingual

Making the rav1d Video Decoder 1% Faster

a year ago
  • #rust
  • #av1
  • #performance
  • Performance improvements in rav1d, a Rust port of the dav1d AV1 decoder, were explored.
  • Two key optimizations were identified: avoiding zero-initialization of buffers and optimizing equality comparisons for small numeric structs.
  • The first optimization involved using MaybeUninit to avoid unnecessary buffer initialization, improving runtime by 1.2 seconds (1.5%).
  • The second optimization replaced field-wise equality comparisons with byte-wise comparisons, improving runtime by 0.5 seconds (0.7%).
  • These changes reduced the performance gap between rav1d and dav1d by about 30%, with a remaining difference of 6%.
  • The approach used profiling to compare performance between the Rust and C implementations, focusing on specific functions and assembly calls.
  • The optimizations were implemented without introducing new unsafe code, maintaining safety while improving performance.