Should programmers learn how to code in assembly? | Lex Fridman Podcast
Experts from the FFmpeg/VideoLAN community discuss the value of learning assembly language programming, critiquing traditional teaching methods and advocating for problem-focused learning. They also debate Rust's merits and limitations, particularly in the context of existing high-performance codebases. Notable assembly wizards Henrik Gramner and Martin Storsjö are highlighted as exemplars of the craft.
Summary
The conversation opens with Kieran criticizing how assembly is traditionally taught — through grammar-focused instruction covering every instruction — rather than through practical, problem-solving approaches. He draws an analogy to learning a spoken language, arguing you learn by communicating, not by studying sentence structure. He describes assembly as a 'dying art' passed down person-to-person like blacksmithing, which doesn't scale, and explains his ASM-lessons project aimed at teaching assembly in the FFmpeg style, focused on vector operations and real problems, requiring only high school math and knowledge of C pointers.
The discussion touches on LLMs and their limitations in helping with assembly, noting there isn't enough assembly corpus online for models to train on effectively, leading to hallucinations and incorrect optimizations. One speaker shares his background doing assembly for the Itanium processor, which had extreme computational power but a memory bus bottleneck — a challenge no high-level language could address — illustrating why deep assembly knowledge matters.
The x86inc framework by Laurent is mentioned as enabling broader contributions, including from students who submitted patches to X264 after studying the lessons. The speakers argue that understanding assembly helps programmers understand memory architecture (registers, L1/L2/L3 cache, RAM, SSD), making them better programmers overall.
The conversation shifts to Rust, where the speakers have divergent but nuanced views. One finds value in Rust's memory safety model and considers it a better C++ for new projects, particularly for parsing and networking. However, both agree Rust is poorly suited for integrating into existing complex codebases, and the 'rewrite everything in Rust' mentality is criticized. A key technical point is raised: even if C code is rewritten in Rust for security, handwritten assembly (necessary for performance) breaks the security model entirely since assembly can jump anywhere in memory. A proposed solution is compile-time instrumented 'secure assembly.'
The transcript closes with praise for two assembly wizards: Henrik Gramner, who knows Intel x86 SIMD instruction cycles across CPU generations so well that Intel engineers defer to him, and Martin Storsjö, an ARM assembly expert who reportedly writes assembly on his phone while watching his kids at the playground. The speakers note that x86 assembly, due to out-of-order execution, is more forgiving across variants, while ARM requires understanding many distinct processor generations and Apple-specific variants, making it a more complex target.
Key Insights
- Kieran argues that assembly is traditionally taught the wrong way — grammar and instruction-first — analogous to learning a language by studying sentence structure rather than by solving real communication problems, which is why his ASM-lessons project takes a problem-focused, vector-operations approach instead.
- One speaker argues that even if C code in a project like H.264 is rewritten in Rust for memory safety, the security model is entirely broken the moment handwritten assembly is introduced, because assembly can jump anywhere in memory — suggesting 'secure assembly' with compile-time checks is the real solution needed.
- Kieran characterizes Rust with a 'very big Esperanto vibe' — too utopian and self-important, reminiscent of the Sinclair C5 electric car, arguing that to get adoption it needs to be as good as or better than existing solutions, not just promise a safer utopia, and that it isn't at that stage yet.
- One speaker explains that it is an order of magnitude easier to write code than to read code, which is why developers arriving at complex codebases instinctively want to rewrite rather than understand — and this phenomenon is visible even in LLMs, which can generate code more easily than they can analyze it.
- Henrik Gramner is described as knowing Intel x86 SIMD instruction cycle counts across nearly every CPU generation so thoroughly that Intel engineers themselves direct questioners to him rather than answering, and Martin Storsjö is said to write ARM assembly on a virtual phone keyboard while watching his kids play at the playground.
Topics
Transcript
[0:02] There's this nice repo with the assembly lessons. First of all, do you think developers should learn how to program in assembly? And how would you go about learning it? What is this ASM-lessons? >> So, I I personally wasn't happy with the way assembly is taught in books and online. Cuz it's very grammar focused and you don't in general learn a language from learning the grammar and the structure. You You learn a language by [0:34] asking someone what their name is and you start from there and you go and solve real problems that you have when you want to communicate. You don't You don't learn sentence structure. This is the interrogative and the adverb and…
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.