POV-Ray : Newsgroups : povray.off-topic : Time is not free : Re: Time is not free Server Time
3 Sep 2024 21:15:48 EDT (-0400)
  Re: Time is not free  
From: Orchid XP v8
Date: 13 Nov 2010 09:28:11
Message: <4cdea07b$1@news.povray.org>
>> It's a lazy calculation. Hopefully the compiler can figure out when it
>> doesn't actually need to do that.
>
>    It's provable (no, not a typo of "probable", different thing) that, in
> the general case, the problem "will this line of code ever be executed?"
> is an unsolvable problem. Hence a compiler can make that decision only
> in the most trivial cases.

More tractable is "if X is executed then Y is definitely executed". For 
example, the arguments to (+) [over integers] will always be executed. 
Therefore, any code that calls (+) can just pass two integers, rather 
than bothering to build a graph of heap objects to pass.

It would be one thing if the compiler knew about the special properties 
of built-in functions like (+). But in fact it performs a "strictness 
analysis" pass which infers this information for all user-written code.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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