digitalmars.D - D compilation speed vs. go
- Andrei Alexandrescu (6/6) Apr 11 2010 I stumbled upon this:
- bearophile (4/7) Apr 11 2010 LDC is slower than dmd.
- Robert Clipsham (12/15) Apr 11 2010 It's still a lot faster than the likes of gcc :D It's no way near as
- bearophile (5/6) Apr 11 2010 Thank you for your timings.
- Robert Clipsham (5/11) Apr 11 2010 What I meant was the tango build system compiles one file at a time, so
- Robert Clipsham (7/11) Apr 11 2010 For ldc it looks like there's about a 5 second difference (I don't have
- Walter Bright (5/9) Apr 11 2010 That comes from my experience in trying to make a 16 bit compiler on
- Robert Clipsham (5/9) Apr 11 2010 It's a shame I can't make it to ACCU next week, I'd love to see your
- Walter Bright (2/6) Apr 12 2010 Lots of time spent with a profiler.
- Robert Clipsham (13/19) Apr 11 2010 Your curiosity made me curious about this, so ran a little test of my
- Robert Clipsham (2/3) Apr 11 2010 In case you were wondering, this is on a C2D @ 2.2Ghz with 2GB ram.
- Jacob Carlborg (4/10) Apr 11 2010 Is that including the C code? It looks like the C code is almost taking
- Andrei Alexandrescu (4/18) Apr 11 2010 The C code is not part of the measurement (and of the lines count)
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
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
On 11/04/10 16:50, bearophile wrote:LDC is slower than dmd. Bye, bearophileIt'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
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
On 11/04/10 19:15, bearophile wrote:Robert Clipsham: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...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
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
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 :DThat 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
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
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
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). AndreiYour 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
On 11/04/10 17:13, Robert Clipsham wrote:4.85s user 1.18s system 87% cpu 6.937 totalIn case you were wondering, this is on a C2D 2.2Ghz with 2GB ram.
Apr 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). AndreiIs 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
On 04/11/2010 01:59 PM, Jacob Carlborg wrote:On 4/11/10 17:28, Andrei Alexandrescu wrote: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. AndreiI 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). AndreiIs 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