www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D compilation speed vs. go

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
Apr 11 2010
next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
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
Apr 11 2010
parent reply Robert Clipsham <robert octarineparrot.com> writes:
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).
Apr 11 2010
parent reply bearophile <bearophileHUGS lycos.com> writes:
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
Apr 11 2010
parent reply Robert Clipsham <robert octarineparrot.com> writes:
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...
Apr 11 2010
parent reply Robert Clipsham <robert octarineparrot.com> writes:
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
Apr 11 2010
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Robert Clipsham wrote:
 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
That comes from my experience in trying to make a 16 bit compiler on MSDOS run at a reasonable speed! The heritage is still there in the back end, and in the front end D is designed for fast compilation. DMC++ has always been the fastest compiling C++ compiler by a wide margin.
Apr 11 2010
parent reply Robert Clipsham <robert octarineparrot.com> writes:
On 11/04/10 22:12, Walter Bright wrote:
 That comes from my experience in trying to make a 16 bit compiler on
 MSDOS run at a reasonable speed! The heritage is still there in the back
 end, and in the front end D is designed for fast compilation.

 DMC++ has always been the fastest compiling C++ compiler by a wide margin.
It's a shame I can't make it to ACCU next week, I'd love to see your compiler construction session, if only for a few insights into how you managed this! Do you have any tips for keeping compilation speedy, or is it just a process of profiling and experience to find what works best?
Apr 11 2010
parent Walter Bright <newshound1 digitalmars.com> writes:
Robert Clipsham wrote:
 It's a shame I can't make it to ACCU next week, I'd love to see your 
 compiler construction session, if only for a few insights into how you 
 managed this! Do you have any tips for keeping compilation speedy, or is 
 it just a process of profiling and experience to find what works best?
Lots of time spent with a profiler.
Apr 12 2010
prev sibling next sibling parent reply Robert Clipsham <robert octarineparrot.com> writes:
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 :)
Apr 11 2010
parent Robert Clipsham <robert octarineparrot.com> writes:
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.
Apr 11 2010
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
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.
Apr 11 2010
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
Apr 11 2010