All being equal codecs ought to be in WUFFS† rather than Rust, but I can well imagine that it's a much bigger lift to take something as complicated as dav1d and write the analogous WUFFS than to clean up the c2rust translation, if you said a thousand times harder I'd have no trouble believing that. I just think it's worth it for us as a civilisation.
† Or an equivalent special purpose language, but WUFFS is right there
You know it's a good post when it starts with a funny meme. Seems related to the recent discussion: $20K Bounty Offered for Optimizing Rust Code in Rav1d AV1 Decoder (memorysafety.org) | 108 comments | https://news.ycombinator.com/item?id=43982238
Honestly its a little surprising the first optimization he found was something fairly obvious just by using perf. I thought they had discussed the zeroing buffers issue in the first post? The second optimization was definitely more involved/interesting but was still pointed at by perf. Don't underestimate that tool!
There's something about real optimization stories that I find fascinating – particularly the detailed ones including step-by-step improvements and profiling to show how numbers got better. In some way, they are satisfying to read.
Nicholas Nethercote's "How to speed up the Rust compiler" writings[1] fall into this same category for me.
AV1 is an amazing codec. I really hope it replaces proprietary codecs like h264 and h265. It has a similar, if not better, performance to h265 while being completely free. Currently on an Intel-based Macbook it is only supported in some browsers, however it seems that newer video cards from AMD, Nvidia, and Intel do include hardware decoders.
Improving performance of rav1d video decoder
(ohadravid.github.io)289 points by todsacerdoti 22 May 2025 | 105 comments
Comments
https://github.com/rust-lang/rust/issues/140167
† Or an equivalent special purpose language, but WUFFS is right there
Edit: If I had read the next paragraph, I'd have learn about [1] before commenting
[1] https://github.com/rust-lang/rust/issues/140167
AVG-SVT-PSY is particularly interesting to read up on as well.
Nicholas Nethercote's "How to speed up the Rust compiler" writings[1] fall into this same category for me.
Any others?
[1] https://nnethercote.github.io/
Leading me to the conclusion that Rust is a dubious choice for highly optimized SIMD code.