POV-Ray : Newsgroups : povray.pov4.discussion.general : Caching parsed code : Re: Caching parsed code Server Time
24 Apr 2024 15:21:18 EDT (-0400)
  Re: Caching parsed code  
From: Lukas Winter
Date: 15 Apr 2009 12:16:32
Message: <49e60860@news.povray.org>
Am Wed, 15 Apr 2009 13:32:07 +0200 schrieb C:

> Large amounts of dynamically placed objects, such as grass or trees, can
> take a long time to parse.
> Usually you would write these objects to a file, and then just use an
> include statement to place them.
> 
> What if Pov Ray could handle this instead? You would write something
> like this:
> 
> cache "grass"{
>    #declare a=0;
>    #while(a<100000)
>      placeGrass(a)
>      ...
>    #end
> }
> 
> Pov Ray will automatically take the results and and save it to a file
> named grass.
> Anytime the scene is rendered it will check if the file exists, if it
> doesn't the contents of the block will be parsed, otherwise the file
> will just be slotted in in place of the block.
Actually the code should check if the definition of the cache block and 
any functions/prototypes used in it have changed since the cache was 
written. Else people would start complaining that their changes to code 
in chache blocks don't take effect ;)

I think there is a consensus that SDL 4 should be a bytecode-compiled 
language and as such it will execute much faster than SDL 3 did. Such a 
"cache" should be needed much less than now. But sometimes calculations 
are very time-consuming so I think there is some justification for that 
feature.
Historically for POV-Ray, plain SDL has been the only way to save scene 
data to disk. I believe that serialization of scene data would be a 
useful feature, but perhaps instead of developing just another binary 
scene format, POV-Ray 4 could just save compiled bytecode to recreate the 
scene or parts of it. Executing it should be almost as fast as loading a 
binary format while supporting all the complexity behind POV-Ray scenes 
perfectly. Perhaps POV-Ray could even do this caching automatically 
without an extra "cache" block.


Post a reply to this message

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