Rust vs C vs Assembly programming languages - FFmpeg developer explains | Lex Fridman Podcast
An FFmpeg/VLC developer discusses the Rust programming language's strengths and limitations compared to C and assembly. While acknowledging Rust's memory safety benefits, he argues it falls short for real-world adoption due to interoperability challenges, the difficulty of rewrites, and the fact that inline assembly undermines Rust's security model entirely.
Summary
The speaker opens by comparing Rust to Esperanto and the Sinclair C5 electric vehicle — well-intentioned but overly utopian projects that fail to meet the practical bar of being 'as good as or better' than existing solutions. He notes that while memory safety is a worthy goal, Rust's community sometimes prioritizes self-importance over solving real-world problems. He points out that Rust still has only one compiler implementation and cannot randomly break ABI, setting a high bar it hasn't yet cleared for projects like FFmpeg.
Drawing on personal experience adding Rust modules to VLC and building his startup Kyber in Rust, the speaker concedes that Rust is 'a better C++ that cares about memory' and excels at memory ownership — making it excellent for greenfield projects, file parsing, and networking. However, he strongly cautions against the Rust community's instinct to rewrite existing codebases, explaining that reading and understanding existing code is an order of magnitude harder than writing new code. Developers who don't understand legacy wisdom often underestimate the effort required to reach 100% feature parity, getting stuck after the easy 80–90%.
The speaker raises a critical technical point specific to multimedia software: projects like H.264 decoders rely heavily on handwritten assembly for performance. Even if the C portions are rewritten in Rust for security, the inline assembly can jump anywhere in memory, completely destroying the security model Rust was meant to provide. He argues the real solution is 'secure assembly' — compile-time instrumentation of assembly code to prevent arbitrary memory jumps — rather than simply rewriting C in Rust.
Key Insights
- The speaker argues that Rust has an 'Esperanto vibe' — a utopian project where the community focuses too much on self-importance rather than meeting the practical requirement of being as good as or better than existing solutions like C.
- The speaker claims it is an order of magnitude easier to write code than to read it, which is the core reason developers instinctively want to rewrite codebases they don't understand — they skip the hard work of learning existing wisdom and business logic.
- The speaker argues that Rust rewrites inevitably stall because reaching 80–90% feature parity is relatively easy, but the final 10% takes 99% of the effort, echoing the Elon Musk quote that 'prototypes are easy.'
- The speaker identifies a fundamental flaw in applying Rust to multimedia software: even if the C code in a codec like H.264 is rewritten in Rust for memory safety, the handwritten assembly required for performance can jump anywhere in memory, completely nullifying Rust's security guarantees.
- The speaker proposes that the real solution for securing performance-critical software is 'secure assembly' — compile-time instrumentation that checks assembly code to ensure it does not jump to arbitrary memory locations — rather than relying solely on Rust rewrites.
Topics
Transcript
[0:03] Uh, what do you think about the Rust programming language cuz that's a bit of a meme? We have very different opinions with Kieran. I think it's valuable what they're doing in terms of memory safety as a concept. Can they achieve this some of the speed up that assembly achieves? Uh, not not assembly by hand, no. I think that that's a given. C, potentially, but I see it very it has a very big Esperanto vibe about it. It's like we're going to solve this and we're doing this in a particular way. Meaning it's a bit too utopian? There's a lot of focus on the self-importance [0:34] rather than solving real-world problems. It reminds me of…
Full transcript available for MurmurCast members
Sign Up to AccessMore from Lex Clips
Anti-matter & nuclear weapons: Why technology is always a double-edge sword | Don Lincoln
Don Lincoln discusses how advanced energy sources like nuclear fusion, fission, and antimatter represent transformative but double-edged technologies. He argues that science's role is to understand nature, while society must collectively decide how to apply that knowledge. The conversation concludes with a celebration of humanity's innate curiosity as the driver of civilizational progress.
Why antimatter costs $63 trillion dollars to produce | Don Lincoln and Lex Fridman
Don Lincoln and Lex Fridman discuss the extreme difficulty and cost of producing antimatter, noting that Fermilab could only produce about one nanogram per year. They explore the theoretical potential of antimatter as a propulsion system for space travel, while emphasizing that the core challenge is an engineering problem of concentrating energy, not a physics breakthrough.
Is loop quantum gravity wrong? - physicist explains | Don Lincoln and Lex Fridman
Don Lincoln explains the differences between loop quantum gravity and string theory, noting that loop quantum gravity attempts to quantize space itself rather than unify all forces. He discusses how an early prediction of loop quantum gravity — that light speed would vary by frequency — was disproven by gamma ray burst observations, but the theory adapted. He also highlights the landmark gravitational wave observation confirming that gravity travels at the speed of light.
Can antimatter be used as rocket fuel? | Don Lincoln and Lex Fridman
Don Lincoln and Lex Fridman discuss the feasibility of using antimatter as rocket fuel, noting that while it is physically possible, the cost of production (estimated at $62-63 trillion per gram) and containment challenges make it impractical. Lincoln explains that antimatter propulsion is fundamentally an engineering problem rather than a physics mystery, and that breakthroughs would likely come from finding new ways to concentrate energy rather than new physics theory.
Speed of light explained: Was Einstein's theory correct? | Don Lincoln and Lex Fridman
Don Lincoln explains Einstein's special relativity, focusing on the two core premises: the universality of natural laws and the constant speed of light for all observers. He describes modern particle physics experiments that have empirically confirmed Einstein's conjecture. He also reflects on how understanding space-time makes the concept of a universal speed limit intuitive rather than bizarre.