in reply to Golfing and Sprinting

There's a lot you can debate about optimizing code. Everybody will always have their own opinion as to whether a certain optimization is 'useful' or 'necessary'. I tend to lean towards the idea that if major optimizations are needed, then chances are the entire script needs to be rewritten, not just one or two bits. I am also very against so called 'optimizations' where people steal the chance to slip obfuscated code into production code. If you can't come back to an 'optimized' snippet of code a month or two after having 'optimized' it and immediately see what that code does, it shouldn't have been done in the first place. If you created this optimization, you shouldn't have to come back months later to copy and paste the snippet into SoPW and ask what it does!

Replies are listed 'Best First'.
Re: Re: Golfing and Sprinting
by DrHyde (Prior) on Mar 16, 2004 at 09:22 UTC
    If I put a funky optimisation into "serious" code, I tend to leave the unoptimised version in place in a comment. That way, if I need to make changes, I can either:
    • read the unoptimised version to help me figure out what the optimised version does;
    • or I can revert to the unoptimised version, easily change the functionality, and then optimise it again if necessary.
    Yes, this is different from jus saying "use CVS" :-)