low level optimization
Jim Giles
jlg at cochiti.lanl.gov
Tue Apr 16 08:26:51 AEST 1991
>> array[index++] = something;
>> [...]
>
> That's crazy. If you want efficiency in QSort you should use
> pointer arithmetic like:
>
> *(pointer++) = something;
If your compiler does something which makes the first slower than
the second, it's time to get a new compiler. At some time in the
code you had to do something like:
pointer = &array[1];
or even
pointer = array;
The compiler should be able to perform the same operation outside
any loops and achieve the same level of optimization. The user's
code needn't contain such things.
J. Giles
More information about the Comp.lang.c
mailing list