3 ms·
This whole article is a straw man AFAICT. Premature optimisation is not an excuse to avoid thinking about runtime characteristics either at design or implement
by Nursie 4y ago
This whole article is a straw man AFAICT.
Premature optimisation is not an excuse to avoid thinking about runtime characteristics either at design or implementation time.
Premature optimisation is the junior engineer using some cargo-cultish ideas to attempt to shave a couple of instructions off a loop which a) is unlikely to be any sort of bottlneck and b) is going to be picked up by the compiler anyway if it's that simple.
It's spending days of effort making some piece of code faster when in practice that piece of code is neither executed often nor on any critical path.
"The Fallacy of Premature Optimisation" seems to me to be an article which takes the worst behaviours of people who don't believe in optimisation at all, and uses them to dismiss the entire idea that effort could be misapplied in dead-end microoptimisations that don't achieve anything.
- trashtester 4y agoMaybe you've been more lucky than me, but I've seen plenty of such "junior devs" in positions of influence, with titles such as "senior" or "principal" dev, "architect" or "engineering manager". In many places, titles like that accrue automatically as people get older, especially if they play the political game reasonably well. Some of them will then happily do what you correctly label "Premature optimization" in the microcode, but proceed to make big mistakes in the overall design that leads to several orders of magnitude slowdowns in the general design. I believe the problem is in the training. As junior devs, they may have been scolded for premature optimizations of microcode, but worked within a well thought-out design at the macro level. Then they advance in ranks, and have to do the design part as well, but they never learned to think about the performance at that level, something that benefits a lot from some contemplation up front.