EW>better readable and probably faster.
EW> HS> Loop3 :-
EW>Why waste all that precious space, watch your cache and use Duff's device
For one thing, Duff's device is slower than what it should be. If
you'll notice, it's doing it a single character at a time. That's not a
very efficient use of memory bandwidth. Even a normal, non rep movsd
memcpy() would be faster than that. All that means that using it in a
loop will hurt performance.
Second, jumping into a middle of a loop like is _not_ good practice.
Not even close! Code like that is very close to being illegal. It's
not, but it's close, and should be.
Third, it also prevents a smart compiler from recognizing what you are
doing and optimizing for the style of code it generates. As an example
of that, Jerry C. mentioned the other day that his compiler recognises a
simple copy loop (ie: for (x=0;x * Origin: Jackalope Junction 501-785-5381 Ft Smith AR (1:3822/1)
|