|
|
In article <38e6f137@news.povray.org> , "Dejan D. M. Milosavljevic"
<dmi### [at] pttyu> wrote:
> add at line 34: #define Assign_Matrix(a,b) memcpy(a,b,sizeof(MATRIX))
> add at line 35: #define MZero(m) Assign_Matrix( m, MATRIX__MZero )
> add at line 36: #define MIdentity(m) Assign_Matrix( m, MATRIX__MIdentity )
At least for MZero to copy the data will be significantly slower than the
current solution. It will require the processor to fetch data from memory
and copy it to another, while the current code will only fill an area of
memory with a fixed value.
Regarding MIdentity, the memory copy might be faster, depending on the
branch penalty of the processor pipeline in the current implementation
compared to the memory access penalty.
However, it should be faster to replace it with the MZero code and then add
the diagonal "one"s outside the loop.
Conclusion: Sometimes what seems less work can turn out to be much more
work.
Thorsten
Post a reply to this message
|
|