What would be the penalty of performing the optimisation if you don't need it?
Why make something more complicated when it doesn't bring you any benefit? Some obvious disadvantages:
- You waste time writing more complicated code, with no benefit for your application;
- You make life harder for whoever has to maintain the code later (whether that’s you or someone else), again with no benefit;
- The optimised code, being more complicated, is more likely to have bugs;
- etc.
| [reply] |
| [reply] [d/l] |
How many of those still apply?
All of them, I think. I suppose you could argue that (1) doesn't apply if you're copying and pasting the code from Perl Monks, but you still have to understand the code and adapt it to your precise requirements, both of which are more difficult when the code is more complicated.
I'm bewildered by your objection, to be honest. Do you seriously think it's a good idea to optimise code that’s already fast enough? There’s an interesting debate to be had about “premature optimisation”, but I've never heard anyone advocate needless optimisation.
Perhaps I'm missing your point. Would you care to elaborate?
| [reply] |