A little of Partial Compilation

bearophile bearophileHUGS at lycos.com
Tue Aug 19 07:09:18 PDT 2008


One simple example of partial compilation: if the D compiler sees that some parameter N of a function is a known constant at compile time (or it can be computed at compile time by other means) it may automatically turn the function into a function template that takes N as a compilation constant, and this may create an actual compiled function that is simper/faster:

foo(int N, float M) => foo(int N)(float M)
automatically if N is a known constant at compile time.

One disadvantage of this suggestion is that in some situations it can produce more code to be compiled, and the resulting compiled code may require more I/O traffic on the code L1 cache, and this may slow down the running a little.

Bye,
bearophile



More information about the Digitalmars-d mailing list