4 ms·
In my experience few people think that optimizations are to be avoided at all costs. Whereas it's very very common for people to try micro optimizing their code
by ChrisSD 6y ago
In my experience few people think that optimizations are to be avoided at all costs. Whereas it's very very common for people to try micro optimizing their code as they write it. Generally speaking it's much easier to profile and refactor well written but potentially slow code then it is to try to understand and untangle a mess of "optimizations" that are also a performance nightmare.
Admittedly this may depend on the domain you're working in. And of course some people may take the advice to an extreme in the other direction but this is (IMHO) rarer and much easier to correct.
- gpderetta 6y agoI would say that the general trend these days is definitely in the other direction outside of some niches. Performance is a design issue and it is hard to do as an afterthought. In fact often microptimizations are the only optimizations you can do without changing your design.
- ChrisSD 6y agoI'm certainly not against micro-optimizations. But they are very context sensitive and cannot be done without proper profiling of the whole program using representative workloads. I find people are often writing spaghetti code because they heard it's "faster". That said I would draw a distinction between implementation and design. The surface API needs to be well thought out before hand. But this should be done before writing any real code (exploratory code aside).