[Tutor] Over optimizing
Mike Hansen
mhansen at cso.atmel.com
Mon Oct 18 19:42:22 CEST 2004
[steps up on soapbox]
Lately there's been a lot of talk about getting various code snippets to
run faster. It's good to exercise your brain coming up with better ways
to optimize code and get exposed to different methods of writing code. I
would like to offer a little bit of caution for those new to
programming. Many programs run into problems when the the programmer is
overly concerned with optimizing. Sometimes inadvertently sacrificing
stability and readability in the name of optimization. Sometimes the
clever optimization becomes difficult to read and possibly difficult to
modify. In general, you should worry about optimizing code only when it
appears to be running too slow. Don't try to second guess the program's
performance. Machines are pretty fast these days, and are getting
faster. In short, get it working, make sure it's readable, and optimize
only if it's performing too slow.
Just an opinion based on some books I've read and some experience.
Thanks
[steps off soapbox]
Mike
More information about the Tutor
mailing list