I know this and read it it many times.
Agner has a good code but don't forget you can't always use it for all the programs.
For example, his function StrCpy is good for large strings, but for small strings, we don't need it.
There are very good ideas because he does not speak about asm only, he introduces optimizations for many languages.
I apply his rules for unrolling loops, when I have a loop like this:
for(i = 0 i < 256 ; i=i+4)
{
DoSomething(i) ;
DoSomething(i + 1) ;
DoSomething(i + 2) ;
DoSomething(i + 3) ;
}
In my program I need to transform the image from RGB to Grey.
I make the transformation using the average of Red, Green and Blue.
Rather than making Average = (Red + Green = Blue) / 3;
I have a table fo 256 entries nto which I already have computed the average.
I get it doing _r = _g = _b = TabDiv3[_r + _g + _b] ;
If I would repect the standard, it is not for today, I would have three tables, one for Red, one for Green and an other for Blue.
_r = TabStdRed[_r] ;
_g = TabStdGreen[_g] ;
_b = TabStdBlue[_b] ;
Grey = _r + _g + _b ;
I think it is quicker. An other idea is to replace the division by 3 using magic numbers, difficult in C.
I would finish repeating what Mr Pelles told me, having a good algorithm is the best thing.
I think he is TRUE.
But for finishing, Mr Pelle or Frankie must have good ideas on the subject that would be very interesting if they would...