2 ms·
You realy have to ask why it was optimized in the first place. Now if that optimization has been negated by the enviroment then you can ask yourself the next q
by Zenst 14y ago
You realy have to ask why it was optimized in the first place. Now if that optimization has been negated by the enviroment then you can ask yourself the next question. Does the code need to be or envisaged in the near future to need changing for a reason other than making something that works into something that works and is readable but not as fast.
Both question are important and if you answear no to either then your best leaving the change to a time when you have to change it. Reason being that you may have a margin in the enviroment negating the optimization today, but that may change before you need to change the code for a reason of business. You could end up beutifying it and losing that optimization and then end up hitting that wall a few months/years down the line and have to reinvent that optimization.
Over all the most important aspect about reading code is to understand the structure and by that this part does this and that part does that. If your calling a optimized load of code in a function then if that code is sexy looking or not it will still have the same look from anything that calls it.
So as a rule, if you don't have to touch it and don't need to touch it then ask yourself why your touching it and are you workbombing yourself with something in a less busy period that will drag on over into a busy period and cause you regret it down the line. Also make sure your doing it for the right reasons, beyond putting a flag ontop of a mountain so to speak, what are you gaining. If something works and does not need to change then changing it just to make it pretty is like arguing all programmers should be wearing size 0 dress's to many peoples minds.