POV-Ray : Newsgroups : povray.advanced-users : function optimization question : Re: function optimization question Server Time
29 Jul 2024 12:24:21 EDT (-0400)
  Re: function optimization question  
From:
Date: 15 Mar 2002 13:49:14
Message: <5fg49ucdqt4o5ormk2g75rcckq30o1s4pl@4ax.com>
On Fri, 15 Mar 2002 12:33:16 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> > Note expression "x*Ey+y*Ex-R1*Ex" appear twice. How many times is it
> > calculated ?
>
> 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. 

Then it is feature request for 4.5 since 4 will by much more complex task
around rewriting.

> 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.

As I remember text output of function parser - there were some kind of float
variables/registers/stack entries. I though that every such float has
dictionary feature (similiar to dictionary used gif coding) where every float
has preprocessed string (without whitespaces) with syntax used to build this
expression. So when new expression is calculated then it is verified with
dictionary and use reference to ready float. But my imagination was probably
far from implementation so forget it.

ABX


Post a reply to this message

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