"Clean" Code, Horrible Performance

Molly Rocket · 1.2M views · 2023 · 22:41

Open on YouTube

Software performance & optimizationSoftware architecture & designcommentary

Why Hacker News recommends it

A frequent citation in debates about SOLID and Clean Code, representing the performance-first side of the argument.

What it is

Casey Muratori shows how typical 'clean code' object-oriented patterns can cost large factors in performance. He benchmarks them against simpler data-oriented code.

Recommended by 3 HN commenters across 5 different months, 2023 to 2026.

What Hacker News said

Recommends GuestHNUser · 2023-11 · on “Ask HN: Learning new coding patterns – how to start?”

> What resources do you recommend folks at my level look into? I'd argue that your best bet for learning is starting a project that drives you, then throwing that project away and starting it over again but try to make the code simpler. This way you can hone into what abstraction is actually necessary to solve your problem. I strongly recommend ignoring design patterns and instead honing in on what the essential data flow is in your problem space. Most design patterns will bloat your code base and, thus, slow both your program and your programming velocity down. As far as programming design and architecture goes, the best talks I have found come out of data orientated design talks. Casey Mur

Recommends GuestHNUser · 2024-04 · on “How do you recognize an expert?”

The issue with those books is that they don't have any concrete data that affirms that they are worth following. And, in fact, that style of code is largely to blame for why modern software feels so sluggish. They often reduce performance by 10x if not 100x or worse. I like this video on the topic for reasons not to follow SOLID principles[0]. Muratori also has an excellent talk on writing APIs that are flexible and performant[1]. As for books on understanding the hardware performance, Computer Systems: a Programmer's Perspective, is the best example (not the international edition though, according to the author's recommendation). I'm not aware of any architecture books recommended by anyone

Recommends xiphias2 · 2024-08 · on “Ask HN: What books should I read to improve as a software engineer?”

Look at Casey Murrey's Clean Code horrible performance youtube video: [this video] I also watched clean code videos and used it in practice, and why it _felt_ right my code size blew up and actually it got harder to understand by other people instead of easier. Nowdays my main guidelines are getting a balance between less lines of code (while still readable), readable variable names and better performance. Also I may get hate here for it, but I learned a lot from watching George Hotz programming tinygrad (available on YouTube).

Recommends latexr · 2025-03 · on “Ask HN: Is Clean Code a waste of time?”

You may enjoy “"Clean" Code, Horrible Performance”, from Casey Muratori. [this video] Casey specialises in game engine research and development [LINK] And has an ongoing course on computer performance for programmers. [LINK]

Recommends xiphias2 · 2026-07 · on “Solid and Clean Code never felt solid or clean to me”

If you want something real, look at Clean Code Horrible Performance youtube video if you haven't. I also found Bob Martin entertaining, but after trying to follow his suggestions I just got into the trap that Casey Muratori shows: even if I don't care about the performance of the code at the start, the amount of abstractions Uncle Bob advises makes it just too easy to make the code extremely hard to optimize later. [this video]

Cites akasakahakada · 2023-07 · on “Ask HN: Resources for High Performance Computing?”

1. Single-thread performance This is hardly related to HPC. The closest thing maybe code optimization and competitive programming. First learn how to do anything fast in single process, then think about scale it up later. 2. Parallel programming Learn MPI. Specifically mpi4py. Once you go MPI, you never use python's multiprocessing module (it sucks). But stuffs are mostly about solving linear algebra problems, which I am not that interested in. 4. Distributed Computing Related to MPI. But nowaday distributed GPU computing become a thing, thing that I can think of is Dask. Don't know how to use that. [LINK] 5. Quantum Computing Completely unrelated to HPC, at least in the near future (10 to 3

Cites GuestHNUser · 2023-11 · on “Push ifs up and fors down”

Thanks for the thoughtful reply. > Well it's hard to argue about that tradeoff in general, but I think the existence of languages like Python, Ruby and PHP is compelling. Though I'd accept the argument that they help optimise for neither performance nor changeability! I see the point you're making, and I don't disagree with it. But I should be a bit more clear in what I really meant in my parent comment: Given whatever language a developer is working in, whether it is fast like C++ or a slow language like Python (or perhaps even Minecraft Redstone), I think the programmer that takes a data oriented approach (meaning they write their code thinking about the kinds of data the program can recei

Cites codetrotter · 2025-01 · on “One Dog vs. the Windows 3.1 Graphics Stack”

See for example this playlist of videos of his with some videos from 2021 where he implements a terminal emulator. As he says himself, this project is not so much about terminals as it is about software development practices in general. [LINK] See also this video of his: “Clean” Code, Horrible Performance [this video]