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
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.
Hitler's role in development of psychoanalysis and psychology | Andrew Scull and Lex Fridman
This discussion traces how Nazi persecution of psychoanalysts during WWII led to their migration to America, where the field underwent a dramatic transformation. Clinical psychologists emerged as competitors to psychoanalysts by developing shorter, measurable, evidence-based therapies like cognitive behavioral therapy (CBT) that focused on treating symptoms rather than reconstructing entire personalities.
Prison system is an insane asylum | Andrew Scull and Lex Fridman
Andrew Scull discusses how the deinstitutionalization of psychiatric asylums has failed people with serious mental illness, leading to a crisis where the largest psychiatric facilities in the US are now jails rather than hospitals. He argues that while asylums had serious problems, the promised 'community care' alternative never materialized, leaving vulnerable populations cycling through brief hospitalizations, homelessness, and incarceration.