True, although not knowing what needs to be optimized guarantees that you don't know how to optimize it :).
> knowing more about how to actually write optimized code can help you make more informed decisions earlier on in the development process.
Totally agree though, despite poking a bit of fun.
This is something that I've been decently good at for many years. If I had to give someone new to it advice, it'd be:
- learn how to repeatably measure your system without introducing too much overhead. If you get this wrong, you're going to end up tricking yourself into believing you've made an improvement but instead got lucky/unlucky.
- once you've found the repeatably-measureable hotspots, the optimization approach is going to depend dramatically on the problem domain. Optimizing for database disk throughput is different than optimizing for http server response-latency is different than squeezing more polygons into a frame in a game.
The one very important thing to keep in mind though is that you're going to need to peel back the abstractions and understand what's happening under the hood. This applies to both parts. Maybe the way to measure what's happening in your network service is to use tcpdump to capture the raw packets and see that you're sending a bunch of small writes into a socket instead of a single big write (why is that a problem? :D). Or something like NVidia NSight can provide a ton of insight into what's happening on your CPUs and GPU frame-to-frame.