[Marble-devel] Review Request: Minor speed-up: do not carry out multiplications inside the inner loop.

Bernhard Beschow bbeschow at cs.tu-berlin.de
Fri Jan 22 19:47:45 CET 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/2650/#review3792
-----------------------------------------------------------


FYI: This optimization is called an "induction variable elimination" (see http://en.wikipedia.org/wiki/Induction_variable_recognition_and_elimination) and is considered by a modern compiler automatically. However, a compiler may even decide that this optimization would result in additional memory access, in wich case the multiplication is cheaper. In the end, the compiler will rewrite the code anyway, namely in a way it considers optimal. Lesson learned: Write readable code; the compiler will optimize for you. :-)

- Bernhard


On 2010-01-20 07:24:04, Ariya Hidayat wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/2650/
> -----------------------------------------------------------
> 
> (Updated 2010-01-20 07:24:04)
> 
> 
> Review request for marble.
> 
> 
> Summary
> -------
> 
> This is for pixelValueApprox function. We skip the multiplications by doing variable increments ourselves.
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.cpp 1077405 
> 
> Diff: http://reviewboard.kde.org/r/2650/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Ariya
> 
>



More information about the Marble-devel mailing list