POV-Ray : Newsgroups : povray.general : Function performance : Re: Function performance Server Time
29 Jul 2024 12:27:09 EDT (-0400)
  Re: Function performance  
From: David Given
Date: 22 Jul 2011 17:51:50
Message: <4e29f0f6$1@news.povray.org>
On 22/07/11 22:25, Thorsten Froehlich wrote:
[...]
> Well, as said, without the SDL I can't help as that is what in the end
> determines how your functions are evaluated.

I'm not looking to optimise this specific bit of code. I'm looking for
general strategies in how to optimise code in general.

For example: I assume that Povray parses functions into an AST, and then
evaluates them by traversing the tree. Once the AST has been
constructed, does it run any of the standard compiler optimisation
algorithms on this such as common subexpression elimination or constant
propagation?

e.g. in my original example, when evaluating result(), f_r() is
referenced three times with the same parameters. Is Povray clever enough
to spot this and only evaluate it once?

-- 
┌─── dg@cowlark.com ─────
http://www.cowlark.com ─────
│
│ "I have a mind like a steel trap. It's rusty and full of dead mice."
│ --- Anonymous, on rasfc


Post a reply to this message

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