Jump to page: 1 29  
Page
Thread overview
Is there any language that native-compiles faster than D?
Aug 20, 2020
Per Nordlöw
Aug 20, 2020
kinke
Aug 20, 2020
Per Nordlöw
Aug 20, 2020
kinke
Aug 20, 2020
kinke
Aug 20, 2020
Per Nordlöw
Aug 20, 2020
kinke
Aug 21, 2020
Per Nordlöw
Aug 20, 2020
Per Nordlöw
Aug 20, 2020
Stefan Koch
Aug 26, 2020
Atila Neves
Aug 26, 2020
Stefan Koch
Aug 20, 2020
Guillaume Piolat
Aug 20, 2020
oddp
Aug 23, 2020
Per Nordlöw
Aug 23, 2020
Per Nordlöw
Aug 23, 2020
Per Nordlöw
Aug 23, 2020
oddp
Aug 23, 2020
Per Nordlöw
Aug 23, 2020
Per Nordlöw
Aug 21, 2020
Andrej Mitrovic
Aug 21, 2020
Jacob Carlborg
Aug 21, 2020
Per Nordlöw
Aug 21, 2020
Jacob Carlborg
Aug 21, 2020
Per Nordlöw
Aug 21, 2020
Per Nordlöw
Aug 21, 2020
Per Nordlöw
Aug 21, 2020
Per Nordlöw
Aug 21, 2020
Per Nordlöw
Aug 21, 2020
Mike James
Aug 21, 2020
Per Nordlöw
Aug 21, 2020
Adam D. Ruppe
Aug 21, 2020
Per Nordlöw
Aug 21, 2020
Adam D. Ruppe
Aug 26, 2020
James Lu
Aug 26, 2020
James Lu
Aug 26, 2020
James Lu
Aug 26, 2020
James Lu
Aug 26, 2020
James Lu
Aug 26, 2020
James Lu
Aug 26, 2020
James Lu
Aug 27, 2020
Atila Neves
Aug 26, 2020
Jacob Carlborg
Aug 26, 2020
jmh530
Aug 27, 2020
Jacob Carlborg
Aug 27, 2020
Atila Neves
Aug 26, 2020
MrSmith
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
MrSmith
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
MrSmith
Aug 26, 2020
MrSmith
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
MrSmith
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
MrSmith
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
Per Nordlöw
Aug 27, 2020
Per Nordlöw
Aug 27, 2020
MrSmith
Aug 27, 2020
Per Nordlöw
Aug 27, 2020
Per Nordlöw
Aug 27, 2020
MrSmith
Oct 05, 2020
Per Nordlöw
Oct 05, 2020
MrSmith
Aug 26, 2020
Per Nordlöw
Aug 26, 2020
MrSmith
Aug 27, 2020
Per Nordlöw
Aug 27, 2020
Jacob Carlborg
Aug 26, 2020
Per Nordlöw
Sep 25, 2020
Per Nordlöw
Sep 28, 2020
Per Nordlöw
Sep 29, 2020
Jacob Carlborg
Sep 29, 2020
Per Nordlöw
Sep 29, 2020
Jacob Carlborg
August 20, 2020
After having evaluated the compilation speed of D compared to other languages at

    https://github.com/nordlow/compiler-benchmark

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.
August 20, 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
>
>     https://github.com/nordlow/compiler-benchmark
>
> 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 this:

-----
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.
August 20, 2020
On Thursday, 20 August 2020 at 21:21:39 UTC, kinke wrote:
> 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.

Thanks. But for really large files that won't make that big of difference. I'll add the generation of the object.d file aswell.

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

I'm aware of that. But I wanted to start somewhere and expand from there.
August 20, 2020
On Thursday, 20 August 2020 at 21:34:54 UTC, Per Nordlöw wrote:
> But for really large files that won't make that big of difference.

Of course not, but your benchmark is as tiny as it gets. ;)

> I'll add the generation of the object.d file aswell.

For linking, a D main requires the _d_cmain template imported by object.d, so you'll have to make it extern(C) in that case.

> I'm aware of that. But I wanted to start somewhere and expand from there.

I don't think languages can be compared like that. One would probably need a reasonably-sized non-contrived project and port it to each language, exploiting the language features, but then runtime and standard libraries would play a significant role as well (object.d kinda already does).
Another strong suit of D, its module system and compiling multiple modules at once, isn't reflected either.
August 20, 2020
I've just seen that you use ldmd2, not ldc2 directly. This makes quite a difference for such tiny code, in my case (with -c, not -o-) something like 60ms vs. 42ms.
August 20, 2020
On Thursday, 20 August 2020 at 21:49:16 UTC, kinke wrote:
> Of course not, but your benchmark is as tiny as it gets. ;)

Ah sry, just seen now that the table has been generated with `--function-count=200 --function-depth=450`.
August 20, 2020
On 8/20/20 4:50 PM, Per Nordlöw wrote:
> After having evaluated the compilation speed of D compared to other languages at
> 
>      https://github.com/nordlow/compiler-benchmark
> 
> 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.

I tried Python a while ago, the build-run cycle for a simple program was about the same. For Perl it was faster.

August 20, 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
>
>     https://github.com/nordlow/compiler-benchmark
>
> I wonder; is there any language that compiles to native code anywhere nearly as fast or faster than D, except C?

Object Pascal / Delphi has been very fast in the past, perhaps the existing Pascal compilers still are.


August 20, 2020
On Thursday, 20 August 2020 at 21:49:16 UTC, kinke wrote:
> For linking, a D main requires the _d_cmain template imported by object.d, so you'll have to make it extern(C) in that case.

Moreover, I just realized I should probably add a test case with `-betterC` aswell. Or maybe make it default until `-betterC` is not sufficient.
August 20, 2020
On Thursday, 20 August 2020 at 22:20:19 UTC, Andrei Alexandrescu wrote:
> I tried Python a while ago, the build-run cycle for a simple program was about the same. For Perl it was faster.

That same as what? D? That entirely depends on the complexity of the Python program. What kind of app/program where you testing?
« First   ‹ Prev
1 2 3 4 5 6 7 8 9