??? 05/17/07 21:41 Read: times |
#139464 - most compilers Responding to: ???'s previous message |
You can speed up your code by unrolling loops and inlining functions if the cost of doing so is less than the cast of keeping them as functions.the metric used to determine if a function is suitable for inlining depends on the compilers idea of 'cost'.You can usualy force a compile to inline any function regardless of its cost metrics.
There is a trade-off between speed of execution and size of the code. You can use other tricks like always decrementing loop counters and so on.You can get c to run 'almost' as fast as hand written code. Recently Ive been using gcc which sometimes misses code optimisations and has a bit of a funny turn when it sees code in which it cannot analyse the dataflow properly so its always a good plan to give the resulting code the once over to see if you can improve it. The project I am working on has 4 arm7's and one arm9 because of all the embedded modules it employs so its not possible to even have sight of 70% of the code which is running which is a little frustrating. |