Thanks Neil.
AlD supplied a link that was extremely enlightening about the issue. I certainly was under-playing the capabilities of C++ optimization!
Jim
>Jim,
>
>Optimisation is not as simple as replacing a byte sized opcode with words and so on an so forth. Look at the following list of optimisations most modern C++ compilers can perform.
>
>global register allocation
>instruction scheduling
>register variable detection
>common subexpression elimination
>dead-code elimination
>variable renaming
>copy propagation
>constant propagation
>strength reduction-induction variable
>tail recursion elimination
>software pipelining and vectorisation
>
>The optimiser has to use a number of strategies to work out best plan, this includes generating profiling information regarding common branch targets, function call frequency and dynamic loop iterations counts. Depending on the compiler you can also provide "hints" to aid in optimisation strategies such as loading of the instruction pipeline or data into the cache.
>
>An common example of where the optimiser will not be able to do its job is the use of registers for the parameter list. Registers are a finite resource, passing in lots of parameters and expecting the compiler to be able to use registers is just not going to happen, however, pass in a pointer to a structure as a single parameter and the optimiser can help you.
>
>Regards
>Neil
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only