Skip to content
0:00 / 0:00

#non-pessimization#caseymuratori#refterm

Refterm Lecture Part 1 - Philosophies of Optimization

Molly Rocket

148K subscribers • 33 videos on Hallway

YouTube
  • Recommended by 10 people: 10 on Hacker News.
  • A classic. People kept recommending it from 2021 to 2024.
  • Presented by Casey Muratori, creator of Handmade Hero
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

92K views5 years ago10 recommendations

Systems programmingSoftware designPerformance and optimizationSimplicity and complexityRefactoring and legacy code

Casey Muratori introduces the concept of non-pessimization, explaining how to write fast software by simply avoiding unnecessary work and complex abstractions.

kickstarter.com/projects/annarettberg/meow-the-infinite-book… Live Channel: twitch.tv/molly_rocket Part 2: youtu.be/lStYLF6Us_Q Part 3: youtu.be/hNZF81VYfQo Part 4: youtu.be/cGoQ3ceKX6g Part 5: youtu.be/e1cvqmXoVaI

Why it's here

10 people recommend this

What people say. Highly recommended by engineers as a foundational lecture on software performance and the philosophy of avoiding premature pessimization.

dundariouson Hacker News • Recommends

On “Anatomy of a Terminal Emulator”

…per bound on performance (so you can measure success/failure), "non-pessimisation" (don't do things extrinsic to the actual task), understanding the actual machine and its capabilities (he doesn't use the term, but sometimes called "mechanical sympathy"), and tactics for isolating "bad code" that you probably have to use (at least to get started). link to this video…

grayreston Hacker News • Recommends

On “55 GiB/s FizzBuzz”

…philosophy of non-pessimization where true optmization (measuring, working hot spots) is rare and rarely necessary but massive speedups compared to the general state of the art are achievable by simply not writing code using patterns that are inherently slow. This isn't deep algorithmic stuff it's just avoiding copies and/or pointer chasing. Edit: link to this video <- Casey's most recent intro to non-pessimization > For a realistic-sized problem, if you write solutions in C and Python with the same amount of effort from equally skilled programmers, the Python version will almost certainly be faster The Advent of Code runs every year and I'm not sure about C (not something I track) but there are plenty…

hsn915on Hacker News • Recommends

On “Selecting a programming language can be a form of premature optimization”

…essimization. Choosing Python or another slow language is premature pessimization. You just make your program slower for no reason. So choosing a language based on how programs written in it perform is simply non-pessimization. If you are interested in an expansion on this idea, checkout Casey Muratori's lecture about philosophies of optimization: link to this video The article makes claims about software being "fast enough" and not needing further optimization. But what you call "fast enough" is probably 10000 times slower than what it could be. I'm not joking. People who program in slow languages have a really skewed perception about performance. If a page takes 5 seconds to load, they don't see that…

jiggawattson Hacker News • Recommends

On “Reclaiming the lost art of Linux server administration”

…ed up at many sites as a consultant at eyewatering daily rates to fix slow apps. Invariably they were missing trivial things like database indexes or caching. Not Redis or anything fancy like that! Just cache control headers on static content. Invariably, doing the right thing from the beginning would have been cheaper. Listen to Casey explain it: link to this video You need to have efficiency in your heart and soul or you can’t honestly call yourself an engineer. Learn your craft properly so you can do more with less — including less developer time!…

AnIdiotOnTheNeton Hacker News • Recommends

On “Infinite Mac: An Instant-Booting Quadra in the Browser”

Honestly you don't even have to think about optimization to make your software not horrifically slow on modern hardware, instead you have to think about non-pessimization. Simply put, avoid needless complexity and gratuitous waste in the first place. See Refterm Lecture Part 1 - Philosophies of Optimization by Casey Muratori: link to this video

infogulchon Hacker News • Recommends

On “Making Code Faster”

I like Casey Miratory's "non-pessimization" approach in Philosophies of Optimization 1 2. He breaks "making a program go faster" into 3 modes: (1) "optimization" which includes counting expected cycles or memory bandwidth, careful benchmarking, designing custom algorithms, etc which can be fun but is expensive and is only rarely applied; (2) "non-pessimization" which is simply avoiding adding extra unnecessary work for the cpu, which should be done 100% of the time but isn't in the industry today; (3) and "fake optimization" which is shallowly repeating 'optimization tips' and conclusions from unrelated cases of (1) without actually measuring it. 1: link to this video 2: link

AnIdiotOnTheNeton Hacker News • Recommends

On “The computers are fast, but you don't know it”

But perfect performance isn't even the benchmark, it's "not ridiculously slow". This is what is meant by "Computers are fast, but you don't know it", you don't even know how ludicrously fast computers are because so much stuff is so insanely slow. They're so fast that, in the vast majority of cases, you don't even need optimization, you just need non-pessimization: link to this video

DeathArrowon Hacker News • Recommends

On “Ask HN: Do you recall any book or course that made a topic finally click?”

I under the impression that we are building software the wrong way. This video from Casey Muratori helped me point to some reasons: link to this video

AnIdiotOnTheNeton Hacker News • Recommends

On “Maybe people do care about performance and reliability”

I'm going to pre-emptively link Casey Muratori's Refterm Lecture Part 10, because invariably when this topic comes up people are all "but optimization takes time and we gotta push the new features right now or the market will eat us." Computers are so ludicrously fast these days that in the majority of cases you do not need optimization at all. You do need de-pessimization though. link to this video

loup-vaillanton Hacker News • Recommends

On ““Clean” Code, Horrible Performance”

Agreed, but most people here haven't paid for the rest of the course, and Casey sometimes forgot that here he's addressing a wider audience. For instance he fails to explain why he didn't bother addressing the tail of his unrolled loop. He does in the course, but here he's just assuming it's irrelevant, and doesn't address again potential criticism like "he doesn't even bother to write correct code, look at that lazy unrolling!" . Thankfully there's a free lecture that explains the broad concept with an example. It's this lecture that convinced me to try out his course, where I hope he'll go into more details: link to this video

Hikikomorion Hacker News • Recommends

On “Performance Excuses Debunked”

He isn't saying that you should spend time on optimising your code, rather that you should write performant code from the beginning by not giving the cpu more work than it needs to do to perform the task, typically by avoiding OO paradigms, followings things like SOLID, etc. Then if needed, real optimisation can handle the hotspots in your code and is typically something that only a few of an orgs best engineers can do properly, but if everything is slow then its an insurmountable task for these few engineers. If you want to understand what he means with this watch the refterm series. link to this video

DeathArrowon Hacker News • Recommends

On “For processing strings, streams in C++ can be slow”

Anything object oriented is slower than anything procedural. Boxing and unboxing is expensive, running constructors and destructors is expensive, copying objects is expensive, virtual tables are expensive. And stuff isn't aligned greatly in memory, we can expect lots of cache misses and branch mispredictions. The fastest possible way is to have C strings in an array and run a function over it. If there are advantages to OOP, speed is not one of them. Here's a great talk about software speed: link to this video

latexron Hacker News • Recommends

On “Is Python That Slow?”

> Casey Muratori has a real in-depth course on why Python is slow and how to make it fast I don’t think that’s a fair characterisation of the course and that description does it a disservice. The course is not about Python, it’s about programming with performance in mind. The video on Philosophies of Optimisation is a good primer on the tenets of the course. link to this video

u/skeetoin r/C_Programming • Mentions

On “Should I try to limit the number of calls to malloc() by allocating large chunks and dishing out portions as needed?”

If you're just rewriting your own general purpose allocator, then there's little point to doing so. However, a general purpose allocator isn't tuned to your specific use case. It has to account for cases you don't care about (multithreading, free order, etc.), and will spend time — probably most of its time — [doing things you don't need it to do]. You know your problem and its constraints, so you can do better than `malloc()` — a lot better in fact. You mentioned linked list nodes. Rather than use a general purpose allocator, you could allocate a large buffer of many nodes (slab allocation, ex.) and draw nodes from this buffer. It will be more efficient than `malloc()`, both in terms of sp…

u/skeetoin r/C_Programming • Mentions

On “Looking for for resources to write a win32 terminal emulator”

Over just the past few months there was all this hubbub about building a high performance terminal emulator for Windows since Microsoft is unable to do so. Here's that series: * How fast should an unoptimized terminal run? * Refterm v2 - Resource usage, binary splat, glyph sizing, and more * Refterm Lecture Part 1 - Philosophies of Optimization * Refterm Lecture Part 2 - Slow Code Isolation * Refterm Lecture Part 3 - Minimal Buffer Processing * Refterm Lecture Part 4 - Glyph Hash Table * Refterm Lecture Part 5 - Parsing with SIMD Source: https://github.com/cmuratori/refterm

u/kbderin r/C_Programming • Mentions

On “How would using C benefits in these projects?”

Don’t worry, simply using C puts you miles ahead of where you were with Python. Casey Muratori makes an interesting distinction between “optimized code” and “non-pessimized code”. The idea is that there is so much modern software which is “pessimized” (anti-optimized), that simply avoiding that puts you near the head of the pack, without actually doing any “optimization”. link to this video