POV-Ray : Newsgroups : povray.unofficial.patches : Matrices: Tiny improvement : Re: Matrices: Tiny improvement Server Time
2 Sep 2024 08:15:16 EDT (-0400)
  Re: Matrices: Tiny improvement  
From: Thorsten Froehlich
Date: 3 Apr 2000 22:55:22
Message: <38e9599a@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.