Jump to page: 1 2
Thread overview
D compilation speed vs. go
Apr 11, 2010
bearophile
Apr 11, 2010
Robert Clipsham
Apr 11, 2010
bearophile
Apr 11, 2010
Robert Clipsham
Apr 11, 2010
Robert Clipsham
Apr 11, 2010
Walter Bright
Apr 11, 2010
Robert Clipsham
Apr 12, 2010
Walter Bright
Apr 11, 2010
Robert Clipsham
Apr 11, 2010
Robert Clipsham
Apr 11, 2010
Jacob Carlborg
April 11, 2010
I stumbled upon this:

http://www.youtube.com/watch?v=wwoWei-GAPo

So the go compiler compiles 120KLOC in 9.23 seconds. I got curious so I just tested dmd against Phobos (88KLOC). That takes 1.24 seconds on my laptop. Not too shoddy. Walter should record a video :o).


Andrei
April 11, 2010
Andrei Alexandrescu:

> I got curious so I just tested dmd against Phobos (88KLOC). That takes 1.24 seconds on my laptop. Not too shoddy.

LDC is slower than dmd.

Bye,
bearophile
April 11, 2010
On 11/04/10 16:28, Andrei Alexandrescu wrote:
> I stumbled upon this:
>
> http://www.youtube.com/watch?v=wwoWei-GAPo
>
> So the go compiler compiles 120KLOC in 9.23 seconds. I got curious so I
> just tested dmd against Phobos (88KLOC). That takes 1.24 seconds on my
> laptop. Not too shoddy. Walter should record a video :o).
>
>
> Andrei

Your curiosity made me curious about this, so ran a little test of my own. To compile tango (user library and runtime library) with dmd on my laptop:

4.95s user 1.12s system 73% cpu 8.235 total

% wc -l `find tango -name \*.d` | tail -n1
  341330 total

So 340k lines of D compiled with dmd compiles in less time than 120k LoC with Go :D

I then noticed this option with tango build tool...

        [-q]                    quick execution

4.85s user 1.18s system 87% cpu 6.937 total

Even faster :)
April 11, 2010
On 11/04/10 17:13, Robert Clipsham wrote:
> 4.85s user 1.18s system 87% cpu 6.937 total

In case you were wondering, this is on a C2D @ 2.2Ghz with 2GB ram.
April 11, 2010
On 11/04/10 16:50, bearophile wrote:
> LDC is slower than dmd.
>
> Bye,
> bearophile

It's still a lot faster than the likes of gcc :D It's no way near as fast as DM, but what do you expect, it has initialize the LLVM backend on each invocation.

Tango (340kLoC):
20.08s user 5.52s system 81% cpu 31.302 total

When using -q:
20.00s user 5.69s system 92% cpu 27.881 total

Looking at the evidence... It's about as fast as the Go compiler, for about 3x the amount of code it takes about 3x the time. It doesn't compare to dmd of course, but the code generated generally runs faster (depending on optimizations, type of code etc).
April 11, 2010
Robert Clipsham:

>It's no way near as fast as DM, but what do you expect, it has initialize the LLVM backend on each invocation.<

Thank you for your timings.
When LDC has to compile many files (for example with xfbuild) can the LLVM back-end be kept running, to avoid some of those statup delays? (If this is not easy to do now, Chris Lattner can probably be willing to improve LLVM to help LDC devs, he is gentle when you ask him doable improvements).

Bye,
bearophile
April 11, 2010
On 11/04/10 19:15, bearophile wrote:
> Robert Clipsham:
>
>> It's no way near as fast as DM, but what do you expect, it has initialize the LLVM backend on each invocation.<
>
> Thank you for your timings.
> When LDC has to compile many files (for example with xfbuild) can the LLVM back-end be kept running, to avoid some of those statup delays? (If this is not easy to do now, Chris Lattner can probably be willing to improve LLVM to help LDC devs, he is gentle when you ask him doable improvements).
>
> Bye,
> bearophile

What I meant was the tango build system compiles one file at a time, so each time ldc is started up it has to reinitialize llvm. I wonder how the timings for ldc and dmd would change if all the files were passed at once...
April 11, 2010
On 11/04/10 19:33, Robert Clipsham wrote:
> What I meant was the tango build system compiles one file at a time, so
> each time ldc is started up it has to reinitialize llvm. I wonder how
> the timings for ldc and dmd would change if all the files were passed at
> once...

For ldc it looks like there's about a 5 second difference (I don't have exact timings), so it does save some time, not a huge amount though.

With dmd it makes an even bigger difference, the previous time of 6.9 seconds looks huge in comparison. Passing all files at once to dmd causes the compilation time to be but down to about 1.7 seconds! That's 340k LoC in 1.7 seconds... I'm in awe :D
April 11, 2010
On 4/11/10 17:28, Andrei Alexandrescu wrote:
> I stumbled upon this:
>
> http://www.youtube.com/watch?v=wwoWei-GAPo
>
> So the go compiler compiles 120KLOC in 9.23 seconds. I got curious so I
> just tested dmd against Phobos (88KLOC). That takes 1.24 seconds on my
> laptop. Not too shoddy. Walter should record a video :o).
>
>
> Andrei

Is that including the C code? It looks like the C code is almost taking longer time and all the D code. But on the other hand they are compiled one at the time.
April 11, 2010
On 04/11/2010 01:59 PM, Jacob Carlborg wrote:
> On 4/11/10 17:28, Andrei Alexandrescu wrote:
>> I stumbled upon this:
>>
>> http://www.youtube.com/watch?v=wwoWei-GAPo
>>
>> So the go compiler compiles 120KLOC in 9.23 seconds. I got curious so I
>> just tested dmd against Phobos (88KLOC). That takes 1.24 seconds on my
>> laptop. Not too shoddy. Walter should record a video :o).
>>
>>
>> Andrei
>
> Is that including the C code? It looks like the C code is almost taking
> longer time and all the D code. But on the other hand they are compiled
> one at the time.

The C code is not part of the measurement (and of the lines count) because the purpose was to measure the speed of D compilation.

Andrei
« First   ‹ Prev
1 2