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
Surprising origin of antipsychotic drugs | Andrew Scull and Lex Fridman
Andrew Scull explains how chlorpromazine, an antihistamine synthesized in the 1880s, was accidentally discovered to have psychiatric applications in the 1950s through French Navy lieutenant Alain Laborit's experiments. The drug's rapid adoption was driven by pharmaceutical companies' aggressive marketing to politicians and hospital administrators rather than by psychiatrists' initial enthusiasm, transforming it from a 'major tranquilizer' into the first 'antipsychotic' drug.
Cognitive Behavioral Therapy (CBT) vs Psychoanalysis | Andrew Scull and Lex Fridman
Andrew Scull discusses how clinical psychology and cognitive behavioral therapy (CBT) emerged after WWII as alternatives to psychoanalysis, becoming dominant through better empirical evidence, shorter treatment duration, and federal funding advantages. CBT's symptom-focused approach proved more measurable and reproducible than psychoanalytic theory, though its effectiveness remains limited for serious mental disorders.
Do anti-depressant drugs work? | Andrew Scull and Lex Fridman
Andrew Scull discusses the history and efficacy of antidepressants, particularly SSRIs like Prozac, explaining that while they statistically outperform placebo, the clinical improvement is often marginal and comes with significant side effects including sexual dysfunction and withdrawal difficulties. He also addresses 'diagnostic creep' in psychiatry, where conditions become increasingly broadly defined and diagnosed over time.
How drugs and psycho-pharmacology changed mental health | Andrew Scull and Lex Fridman
Andrew Scull traces the accidental discovery of psychopharmacology, beginning with chlorpromazine's unexpected psychiatric effects in the 1950s, and discusses how pharmaceutical companies transformed mental health treatment while also introducing serious side effects like tardive dyskinesia and metabolic complications that remain inadequately addressed.
Freud's radical theory of the unconscious mind | Andrew Scull and Lex Fridman
Andrew Scull discusses Freud's development of psychoanalytic theory, including his structural model of the mind (id, ego, superego) and his theoretical innovations like dream interpretation and Freudian slips. The conversation explores how Freudian ideas gained popularity among intellectuals and artists in the 1920s-30s, particularly following WWI's shell shock crisis, despite remaining largely outside mainstream psychiatric institutions that dealt with severely disturbed patients.