Compile time function execution...

janderson askme at me.com
Fri Feb 16 22:07:58 PST 2007


Walter Bright wrote:
> Michiel wrote:
>> Walter Bright wrote:
>>
>>> Many functions could be executed at compile time, but should not be.
>>
>> When should they not be?
> 
> 1) Another poster mentioned a function that decompressed a built-in 
> string - the whole point of having it compressed was to reduce the exe 
> file size. Decompressing it at compile time defeats the purpose.
> 
> 2) A function that simply takes too long at compile time. Compile time 
> execution is going to be >100 times slower than run time.

One thought on this.  What about leveraging multiple threads to 
calculate different algorithms at once.  They should all be self 
contained, so this shouldn't be much of a problem.  With the quad-cores 
the compiled program would run maybe at 30 times slower.  Also its a 
good step towards future-proofing the compiler.

-Joel



More information about the Digitalmars-d mailing list