There is exactly one question you need to have in mind when optimizing a system in depth: “how can I not do this work at all?”

Using #Rust, #wasm, algorithms with nicer Big O, etc, are distractions compared to the simple fact that O(0) will beat them all.

So when you comb over a system, genuinely ask yourself why you’re doing something and what it would take to not do it at all, and only worry about alternative optimizations when you’ve exhausted all possibilities that involve skipping the work altogether.

@zkat correct answer
@zkat I remember an interview years ago where I and a colleague were practically begging the candidate for this answer. They finally said, “I’m sorry. I’ve been working on a class project where I designed my own single board computer, and I wrote an OS for it and I was up all night getting it to boot.” Interview complete, offer extended. One of the most amazing perf engineers ever. Wrote an article on “let’s see if we can make this go faster” that was a joy to read. “Oh, that’s better. Now, can we do it again? Why, yes we can!” So much fun. Glad we stuck with trying to get the answer. It was in there, and how!