Casey Muratori, a game engine developer, writes about performance-aware programming, CPU behavior, and low-level optimization, alongside a video course.
HN commenters repeatedly recommend it as a deep, useful resource for learning low-level performance, especially for people with a game development background.
I like a lot of Muratori’s writing but… is it really wise to take code architecture tips from game devs, of all people? I’m willing to trade lots of performance in exchange of extensibility and stability over the long term.
I’m not a huge fan of overwrought OOP either, but modeling everything with scalars and comments makes it sometimes harder to add new behaviours.
I’m also not a fan of video content, here is a transcript of the above video,
https://www.computerenhance.com/p/clean-code-horrible-performance
If you look at the “not clean” code in the above, it’s fine, it’s still relatively easy to follow etc. Now think about extending it so that some shapes are the result of summing multiple sub-shapes, like a general polygon tiled out of triangles. That’s straightforward in the OOP case, but not so much in the flattened array case, and means that we need to reintroduce pointer indirections if we don’t want our shape union to be as large as our biggest shape etc. (I still might use a switch statement over inheritance.)
Casey Muratori (of Handmade Hero fame, works/worked at RAD Game Tools for a long time) just did that as part 1 of his Performance Aware Programming series he’s doing on his Substack: https://www.computerenhance.com/
The “homeworks” only require implementing basic data transfer, arithmetic, and logic instructions, but I enjoyed it so I implemented everything except the interrupt handler stuff (into, etc.), and the BCD stuff (aaa, etc.).
I agree that it’s a good way to learn, and Casey provides a reference implementation.
There's a nice interview with Mike Clark where he talks about this a bit. His take basically matches this. He says that, in his view, any efficiency benefits of ARM are just that's been the market for ARM. In his view, if x86 had a market motive for ARM levels of efficiency, they'd be able to deliver it. But, historically, the x86 market wants performance more than efficiency, so that's what it gets.
https://www.computerenhance.com/p/an-interview-with-zen-chief-architect
For Elixir specifically, I liked Dave Thomas’ Elixir for Programmers. https://codestool.coding-gnome.com/courses/elixir-for-programmers-2
For learning about performance and low level stuff, Casey Muratori’s Performance Aware Programming course has been great. https://computerenhance.com
For higher level software design stuff (beyond just GoF patterns), check out James Koppel’s writing at https://www.pathsensitive.com/ and his courses at https://mirdin.com
Code is run more than it is read especially if you count users. And so-called "clean" code is a performance disaster[0]. It's also, if that link is an accurate representation of what "clean" code is, a readability disaster. The more readable code, in my opinion anyway, is the version that is also an order of magnitude faster.
[0]: https://www.computerenhance.com/p/clean-code-horrible-performance
I just encountered the term "The Ultimate Sadness" reading https://www.computerenhance.com/p/the-case-of-the-missing-increment immediately before this post and I feel like you've found an even worse sadness to deal with on a regular basis.
My sympathies, and I appreciate your willingness to wade through neck deep licensing excrement to produce something that still works.