optimizing constant ifs out of loop?

Eljay Love-Jensen eljay@adobe.com
Wed Oct 1 17:13:00 GMT 2003


Hi Lyle,

The quote is in reference to micro-optimizations in the programming phase of development.

The quote is not in the context of  encouraging a disregard for good architecture, design and programming practices.

Even the best micro-optimization cannot make up for a poor architecture or design.

My rule of thumb for the programming process:
1. make it work
2. make it work well (i.e., error situations addressed)
3. make it fast

This can be an iterative process (as opposed to strictly linear).  But trying to make a routine fast before that routine is empirically known to be an issue is a bad habit to get into.

Maintainability (99% of the code) is often far more important than micro-optimizations (1% of the code).  And a micro-optimization for one platform (CPU + OS + Compiler) may be a micro-pessimization on another platform.

Sincerely,
--Eljay




More information about the Gcc-help mailing list