HackerTube

Refterm Lecture Part 1 - Philosophies of Optimization

Molly Rocket10 HN recommenders · recommended in 10 months, 2021–2026
YouTube
lecture · intermediate · evergreen · 2021–2026 on HN

Casey Muratori's first refterm lecture lays out philosophies of optimization, distinguishing optimization from non-pessimization, which means avoiding needless work. It uses his fast terminal renderer project to show how fast computers really are.

HN returns to it constantly in software performance debates as the primer on non-pessimization and why modern software is slow.

12 comments from Hacker News

@dundarious2021-11 · in “Anatomy of a Terminal Emulator”

Casey Muratori's refterm video series is a great example of how to do application design. It focuses on writing a terminal emulator for Windows, but almost all the concepts apply to nixes as well -- even down to the level of OS primitives like memory mappings to create a ring buffer, etc. He builds a nearly complete terminal that appears to better support unicode and escape sequences than windows-terminal, in drastically less code and with literally orders of magnitude better performance. In particular, I like his focus on experimentation to figure out a reasonable upper 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). ▶ this video

Strongly recommends View on HN
@latexr2024-11 · in “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. ▶ this video

Recommends View on HN
@DeathArrow2023-12 · in “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: ▶ this video

Recommends View on HN
@Hikikomori2023-04 · in “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. ▶ this video

Recommends View on HN
@AnIdiotOnTheNet2023-02 · in “Maybe people do care about performance and reliability”

I'm going to pre-emptively link Casey Muratori's Refterm Lecture Part 1[0], 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. ▶ this video

Recommends View on HN