POV-Ray : Newsgroups : povray.programming : Parse storage. : Re: Parse storage. Server Time
29 Jul 2024 06:13:51 EDT (-0400)
  Re: Parse storage.  
From: Rudy Velthuis
Date: 3 Feb 1999 08:07:48
Message: <36b84a24.0@news.povray.org>
Spider schrieb in Nachricht <36B7317E.4D09F18E@bahnhof.se>...
>
>
>Rudy Velthuis wrote:


>> But as the POV-team already mentioned somewhere, most time is not wasted
in
>> parsing, but in allocating objects during this process. If this is true
(I
>> can't verify it), the pre-compile wouldn't do a lot of good.
>It depends on the scene, as far as I know. in some cases, I've spent a
>lot of time waiting for a parse to finish. (take a look at the recursive
>tree creation algorithms. Those are very long parsing, but not long if
>declared as a .inc. (try the WinTrees if you like:-) it is from this
>experience that I came with the idea.


I'll have to take a look at the parser, but if this is true, then it's
definitely not the allocation, which takes time, as obviously the result
(the number of objects) would be exactly the same, so the number of
allocations would be the same too.

Only difference is the fact, that WinTree does the recursion once (in Visual
Basic), producing an include file with all objects already spelled out, and
the recursive parser does this while parsing. So parsing is definitely the
culprit here, not allocation.

I have read somewhere, for #while loops, at the #end, the parser must
re-read the source to find the #while, like old BASIC dialects did. If this
is true, propably an improved parser would have some importance (I know, I
know, the POV-team is busy enough), esp. for scenes which use a lot of
grass, trees, leaves, flowers, fur, etc. And these scenes are becoming more
common, as machines are getting more powerful, and memory is getting cheaper
and POV-artist are getting more "courageous" to tackle huge numbers of
objects.

Perhaps there would be demand for a small program, which unravels #while
loops and macros and creates (huge) include files out of them, taking a bit
out of the parsing POV-Ray does. This could work like WinTree, but perhaps a
bit more generalized. So the program would turn a:

  #declare Count = 0;
  #while (Count <= 40)
    sphere { <-1, Count, -1>, 1 }
    #declare Count = Count + 1;
  #end

into:
  // #declare Count = 0;
  // #while (Count <= 40)
  sphere { <-1, 0, -1>, 1 }
  sphere { <-1, 1, -1>, 1 }
  sphere { <-1, 2, -1>, 1 }
  ...
  // #declare Count = Count + 1;
  // #end
  #declare Count = 40;

etc. (40 sphere definitions instead of one simple loop, and Count = 40, we
might perhaps need this later on).

--
Rudy Velthuis


Post a reply to this message

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