POV-Ray : Newsgroups : povray.advanced-users : function optimization question : Re: function optimization question Server Time
29 Jul 2024 12:17:14 EDT (-0400)
  Re: function optimization question  
From: Slime
Date: 16 Mar 2002 03:20:15
Message: <3c93003f@news.povray.org>
> Twice. The function compiler cannot optimise common subexpressions and it
is
> unlikely this feature will be added to it in time for a 3.5 release
because
> it is very complex and would require another intermediate code
> representation layer.  The (current) function compiler has no layer
suitable
> for general optimisations because it performs similfications and
elimination
> of constants in the expression tree.  That tree is then turned into
function
> VM instructions, which is nearly trivial because no complex language
> constructs (which would benefit from such further optimisation as well)
are
> supported by the compiler.

Hmm. I can see how this would be difficult to do automatically, but is there
any chance that 3.5 or a future version could support something where the
user is able to manually select parts of the function that will appear
later? For instance, if I said something like

function{
    f_noise3d(
        x/sqrt(x^2+y^2+z^2),
        y/sqrt(x^2+y^2+z^2),
        z/sqrt(x^2+y^2+z^2)
    )
}

then it has to evaluate that one peice three times. I can plainly see that
this will slow it down. So it would be cool if I could say something like

function{
    f_noise3d(
        x/(remember(1): sqrt(x^2+y^2+z^2)),
        y/(recall:1),
        z/(recall:1)
    )
}

Where the 1 indicates that the remembered item labeled "1" should be
recalled. The syntax I made up here is ugly, but is there any chance of this
functionality appearing in the future?

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]


Post a reply to this message

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