POV-Ray : Newsgroups : povray.off-topic : My hypothesis : Re: My hypothesis Server Time
29 Jul 2024 22:29:57 EDT (-0400)
  Re: My hypothesis  
From: Warp
Date: 6 Sep 2011 16:28:06
Message: <4e668255@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> On 9/6/2011 8:03, Warp wrote:
> > Darren New<dne### [at] sanrrcom>  wrote:
> >> Then the old heap is in oldheap and the new heap is in newheap.
> >
> >    Is this supposed to be efficient?

> If your functional language is pure enough, your compiler can often optimize 
> out the apparent inefficiency. Of course, that requires a Sufficiently Smart 
> Compiler.

  Hmm, for the compiler to be able to elide the copying and make the changes
in-place, it would have to know for sure that those nodes that are being
changed are not being referenced from anywhere else in the program. (Because,
obviously, if they are referenced by something else, that something else is
going to see the change although it shouldn't.)

  I'm not sure how a compiler would be able to do that in a complex program
where nodes and containers are being passed around.

  (Of course the copying is not a big deal if each node contains eg. a
couple of integers. However, it begins to matter if they contain for example
large strings, which isn't all that unusual.)

-- 
                                                          - Warp


Post a reply to this message

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