- cross-posted to:
- programming@programming.dev
- cross-posted to:
- programming@programming.dev
I always see the same thing everywhere: human intuition is terrible for optimisation, always measure, etc. If I’m honest my experience is closer to the opposite.
When a program is slow the path to fixing it usually involves fixing multiple things in very specific ways, often in totally different places. Only after fixing all of them does the blockage disappear, and suddenly everything is lightning fast. That’s really hard to figure out by looking at profiler output. I can only do it by having a mental model of how the program works and inuition about what I would expect to be slow. Following the profiler might get me there after days or weeks of trial & error, or I can just poke around the code and have a think about it.
The profiler is still an important tool, especially for verifying theories and improvements, but in my experience the most important thing is inuition. Just thinking about the ratios of different inputs, the operations performed, the memory layout, the caching and branching behaviour, etc.
The article is not a bad guide, but this one thing always bugs me.