Just listened to this talk by Casey Muratori called "Simple Code, High Performance": youtube.com/watch?v=Ge3aKEmZcq…

It's a case study about a piece of code from the game _The Witness_ (actually, from the art editor for that game) which he rewrote with dramatically better performance.

in reply to Matt Campbell

My summary is that he addressed the original code's poor performance in three stages:

1. He came up with a new algorithm that didn't get progressively slower like the original, and also produced better output.
2. He found that even the new algorithm's inner loop was calling into code that did lots of unnecessary work, including memory allocation, so he instead wrote code that did something much simpler.
3. While he was doing the rewrite for #2, he went ahead and used SIMD.

#2
in reply to Matt Campbell

He had some provocative things to say about the dangers of code reuse and "modern" C++ about an hour and a half into the talk. And I think we Rust programmers have to watch out for these things as well. It's easy to casually use high-level abstractions that aren't appropriate for the situation. I don't think we have to give up Rust's safety to avoid that problem, though; we just have to be aware of what the functions we're calling are doing.