Is there any language that native-compiles faster than D?

kinke noone at
Thu Aug 20 21:21:39 UTC 2020

On Thursday, 20 August 2020 at 20:50:25 UTC, Per Nordlöw wrote:
> After having evaluated the compilation speed of D compared to 
> other languages at
> I wonder; is there any language that compiles to native code 
> anywhere nearly as fast or faster than D, except C?
> If so it most likely needs to use a backend other than LLVM.
> I believe Jai is supposed to do that but it hasn't been 
> released yet.

Pardon me, but that code seems everything but remotely 
representative to me - no structs, no classes, no control flow, 
just a few integer additions and calls. It even seems to make D 
look worse than it is, simply because object.d is imported but 
totally unused. E.g., on my Win64 box with DMD 2.093, compiling 

int add_int_n0_h0(int x) { return x + 15440; }
int add_int_n0(int x) { return x + add_int_n0_h0(x) + 95485; }

int add_int_n1_h0(int x) { return x + 37523; }
int add_int_n1(int x) { return x + add_int_n1_h0(x) + 92492; }

int add_int_n2_h0(int x) { return x + 39239; }
int add_int_n2(int x) { return x + add_int_n2_h0(x) + 12248; }

int main()
     int int_sum = 0;
     int_sum += add_int_n0(0);
     int_sum += add_int_n1(1);
     int_sum += add_int_n2(2);
     return int_sum;

with `dmd -o- bla.d` takes about 37ms, while creating an empty 
object.d and compiling with `dmd -o- bla.d object.d` takes 24ms. 
There's no default includes for C, so this would make the 
comparison more fair.

Additionally, generics and templates are completely different 
concepts and can't be compared.

More information about the Digitalmars-d mailing list