"Clean" Code, Horrible Performance

Channel:Molly Rocket · Length:22:40 · Published:2023-02-28 · Views:1183255

Watch on YouTube

Summary

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

Why HN recommends it

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

Look at Casey Murrey's Clean Code horrible performance youtube video — HN, 2024

Software architecture & design · Software performance & optimization

Subtitles (excerpt)

some of the most often repeated programming advice especially to beginner programmers is that they should be writing clean code and that name is accompanied by a long list of rules that tell you what you should do in order for your code to be clean now there is no Benchmark for this you cannot actually run something and have it tell you how clean your code is but there are fairly descriptive rules that tell you what you should be doing now a large portion of these rules don't actually affect the runtime of the code that you write especially not if it's compiled and so there is really no way to objectively assess whether these clean code ideas are good or bad and we don't necessarily have to because they're fairly arbitrary at that point however there are several aspects of clean code in fact some of the most important ones that are stated are things we could objectively measure because they do affect the runtime of the program that you are writing those are if you go look at a list and pull out the ones that would actually carry through to the code as it is compiled and run on the end user's machine there are things like polymorphism is good so that's like a plus ifs and switches are bad

On Hacker News

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… — xiphias2, 2026-07
You may enjoy “"Clean" Code, Horrible Performance”, from Casey Muratori. [VIDEO] Casey specialises in game engine research and development [LINK] And has an ongoing course on computer performance for programmers. [LINK] — latexr, 2025-03
Look at Casey Murrey's Clean Code horrible performance youtube video: [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 perform… — xiphias2, 2024-08
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 t… — GuestHNUser, 2024-04
> 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 wh… — GuestHNUser, 2023-11

Related videos