While programming optimization that makes ones' code completely unreadable is often a bad thing, there are places for it, like that one inner loop of your code that takes up 98% of the program's running time.
What are you tricks for improving performance in C, other than the obvious inline assembly or the like?
Name:
Anonymous2007-09-16 0:27 ID:Sy2QIfmT
Declare variables as static so the CPU doesnt have to set aside memory on the stack in each function call. Just be sure to reset it each time.
int foo(int a)
{
static int variable;
// ....
variable = 0;
}
Why is that? Is it because adding 8 to (subtracting 8 from, depending on your architecture) your stack pointer is more expensive than adding/subtracting 4?
Name:
Anonymous2007-12-30 1:07
>>92
You're responding to a three-month-old troll.
Name:
Anonymous2007-12-30 3:11
>>95
You're responding to a one-hour-old response to a troll.