In one of my routine I copy the data from one surface to another.
I used to have this simple line in the body of my loop:
I noticed an increase in speed after this change. Is it that the cache is better used, or the fact that I simply unrolled the loop?
Anything else I can do to improve this?
Thanks,
--Eric
I used to have this simple line in the body of my loop:
- Code:
*Destination = *Source;
- Code:
// this is only pseudo code to explain
Destination1 = Dest;
Destination2 = Destination1+Pitch;
Destination3 = Destination2+Pitch;
Destination4 = Destination3+Pitch;
// same for source
// ...
// then do four copies at once:
*Destination1 = *Source1;
*Destination2 = *Source2;
*Destination3 = *Source3;
*Destination4 = *Source4;
I noticed an increase in speed after this change. Is it that the cache is better used, or the fact that I simply unrolled the loop?
Anything else I can do to improve this?
Thanks,
--Eric