Compile time function execution...

Michiel nomail at please.com
Thu Feb 15 15:21:03 PST 2007


BCS wrote:

>>> 6) when the whole program is const foldable, e.i. no runtime inputs,
>>> like with some scientific software.
>>>
>> That's interesting. What kind of program has no runtime inputs?
>>
>> And why would it be a problem if the whole program is reduced to
>> printing constants to the output? It would certainly be small and
>> fast.
> 
> I have a program that calculates the number of N length sequences whose
> sum is less than M. M and N are consts so it has no inputs. Runtime
> speed is of no more importance than compile time speed because I only
> need to run it once for each time I compile it. I'd rather let the CPU
> do the crunching rather than the DMD. It takes about 15min to run as is,
> so that would be about 1500+ min under DMD.

Ah, now I understand the fuss. :) Walter is using an interpreter for the
compile time execution.

All this time I was assuming multiple compilation stages. First compile
the compile-time functions and let the processor run them at compile time.

-- 
Michiel



More information about the Digitalmars-d mailing list