3 ms·
Fast and slow are relative, that’s for sure. But assuming there is a problem before discovering it... isn’t that the definition of premature optimization? I on
by IgorPartola 6y ago
Fast and slow are relative, that’s for sure. But assuming there is a problem before discovering it... isn’t that the definition of premature optimization?
I once watched another developer spend an evening creating a binary tree implementation to do a round robin selection of servers to connect to in order to avoid just iterating over an array and/or having to reinitialize the array when a server is added/removed. We had a total of 4 servers at the time and expected no more than 8 ever for this particular thing. BTW this was written in PHP on top of its built in array().
- ncmncm 6y agoYou would only ever do this on code where performance matters. You ask yourself: if I made this twice as fast (or half as slow) would anyone know or care? If yes, then it's not premature, it's just garden-variety optimization. But choosing the right bit of code to work on needs some investigation. The assumption here is that that has already happened.
- jcelerier 6y ago> Fast and slow are relative, that’s for sure. But assuming there is a problem before discovering it... isn’t that the definition of premature optimization? that works if you have a definite performance target, say, "less than 5ms". Not if your performance target is, "it must be faster by a good margin than all the competitors that we know and don't know about, and stay that way"