[prev] [index] [next]

Efficiency Tricks (cont)

Use local variable instead of global variables ...

May enable compiler to optimize some operations.

i = k + 1;
i = i - j;
x = a[i];

If i is local then compiler may generate:

x = a[k+1-j];