POV-Ray : Newsgroups : povray.general : A couple parser performance issues/optimizations. : Re: A couple parser performance issues/optimizations. Server Time
2 May 2024 17:32:21 EDT (-0400)
  Re: A couple parser performance issues/optimizations.  
From: Alain
Date: 7 Oct 2017 19:45:18
Message: <59d9670e@news.povray.org>
Le 17-10-07 à 19:00, Bald Eagle a écrit :
> William F Pokorny <ano### [at] anonymousorg> wrote:
>> I've borrowed some code Bill Walker (Bald Eagle) posted in the
>> "Isosurface and f_spiral - bug or feature?"  thread started by Ronkar to
>> demonstrate a couple of parser performance issues/user-optimizations.
>>
>> 1) Comments in inner loops are costly. 2) Functions are often much
>> faster than macros.
> 
> I would not have guessed that.  I had always imagined that it bailed out as soon
> as it saw //  but I guess not.

It does ignore whatever is in the coment, but, it have to pace through 
the comment character by character to find exactly where it ends. In a 
loop, it add up quickly.

> Also good to know if
> Code /* inner comment */  more code... is used in a scene file
Same thing. Need to read it all to find the end point.

So, put as much of your coment before the loops so that the parser only 
have to skip it once.

> 
>> With both, parser performance can be positively affected by how we code.
> 
> Yes, I try to learn and apply good coding practices as often as possible - which
> sometimes isn't that often.
> I had been trying to query why a polynomial is [supposed to be] much faster than
> an isosurface or parametric - I have ideas, but no "source code explanation"
> 
>>    Perhaps, the parser code itself can better handle comments. Details
>> and sample code are part of my comment today to the github issue:
>>
>> https://github.com/POV-Ray/povray/issues/313
>>
>> Bill P.
> 
> 
> BTW,
> Using 3.7.1-beta.8
> 
> #version 3.71;
> #declare StartTime = now();
> 
> Gave me a "Need a semicolon" errors.
> Bug Report?
> 
>


Post a reply to this message

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