POV-Ray : Newsgroups : povray.general : Efficiency of parsing... Server Time
4 Aug 2024 14:27:56 EDT (-0400)
  Efficiency of parsing... (Message 1 to 4 of 4)  
From: Tim Nikias v2 0
Subject: Efficiency of parsing...
Date: 31 Mar 2003 07:04:58
Message: <3e882eea$1@news.povray.org>
In my Water-Surface-Simulation WIP I have to make
extensive use of array-look-ups and #if statements,
so I'm trying to use the most efficient way for POV
to parse (even though it might be only like 1 or 2 internal
calculations for POV, this adds up quickly with several
thousands of calculations...).

I've already made use that array-look-up is less efficient
than using a "plain" variable, and I've made use of that
where it would have some significant impact (speak:
whenever I look at the same array-entry for more than
three times).

I'm wondering about the boolean parsing. Is it easier
for POV to do
(A!=1) (is A not equal to 1?) or
(A-1) (is A minus 1 true?).

I'm assuming that (A-1) would be better, but I'm not sure
about that. After all, it just has to subtract 1 and see
if value is still true, whereas with A!=1 it would have to
somehow check if A is 1, and if so, return false.

Anybody have some insight into this?

--
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde


Post a reply to this message

From: ABX
Subject: Re: Efficiency of parsing...
Date: 31 Mar 2003 07:28:38
Message: <plcg8v4lc26vhfpifvsoisa53r8ukm0efs@4ax.com>
On Mon, 31 Mar 2003 14:01:25 +0200, "Tim Nikias v2.0" <tim### [at] gmxde> wrote:
> Anybody have some insight into this?

I have made similiar tests some time ago but for different expressions. Look
into tutorials group.

If parsing is really long than you should consider moving to compiled apps

If possible move conditions outside loops

If possible try predeclared functions for longer expressions

If you want compare two versions of expression then create two scripts with
1.000.000 lines of each expression and measure execution time.

ABX


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Efficiency of parsing...
Date: 31 Mar 2003 08:05:20
Message: <3e883d10$1@news.povray.org>
Thanks for the quick suggestion. In case of
(A-1) and (A!=1) there seems to be no difference.
Its probably just a too easy check to make much
difference...


--
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde

> > Anybody have some insight into this?
>
> I have made similiar tests some time ago but for different expressions.
Look
> into tutorials group.
>
> If parsing is really long than you should consider moving to compiled apps
>
> If possible move conditions outside loops
>
> If possible try predeclared functions for longer expressions
>
> If you want compare two versions of expression then create two scripts
with
> 1.000.000 lines of each expression and measure execution time.
>
> ABX


Post a reply to this message

From: John VanSickle
Subject: Re: Efficiency of parsing...
Date: 31 Mar 2003 13:29:52
Message: <3E88892F.8487CCFD@hotmail.com>
Tim Nikias v2.0 wrote:
> 
> Thanks for the quick suggestion. In case of
> (A-1) and (A!=1) there seems to be no difference.
> Its probably just a too easy check to make much
> difference...

Since comparison is done by means of subtraction, the two pieces of
code should execute at similar rates.

I'm updating my Surface Subdivision Suite (sharp edges, quadrilateral
faces, and uv-mapping), and it's Slooooooooooow.

Regards,
John


Post a reply to this message

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