Andrei's Google Talk

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Aug 3 17:48:29 PDT 2010


Leandro Lucarella wrote:
> Walter Bright, el  3 de agosto a las 15:08 me escribiste:
>> bearophile wrote:
>>> At 14.42: You compare the performance of a D compiler with the performance of
>>> a C++ compiler. But Delphi compiler was/is very fast (and probably the
>>> FreePascal compile too), I have never "waited" for my Delphi (ObjectPascal)
>>> code to compile. I think on average it takes only two thousand clock ticks to
>>> compile one line of ObjectPascal code. It sounds a lot, but it means that
>>> with a modern single-core CPU you can produce your binary file from a one
>>> million ObjectPascal lines long program in less than two seconds.
>>> ObjectPascal type system looks a bit simpler than D one (despite it has OOP,
>>> generics, modules, inline asm, dynamic strings, records, all basic D types,
>>> etc), so this isn't a fully apple-to-apple comparison.
>>
>> Some context is in order. The talk was given at Google and aimed at
>> what would be interesting to Googlers. Google uses C++ extensively,
>> and Rob Pike (of Go) listed as a motivator for Go the compile speed
>> problems with C++. Rob made a point of how fast Go compiled code,
>> and Go's compile speed has been praised a lot on Reddit as well.
>>
>> Andrei put together a benchmark that shows that D compiles 4 times faster than Go.
> 
> I was surprised by that, can you publish what the benchmark was, and
> what compilers were used? I tried Go when it came out and it felt faster
> than D to compile (which is reasonable because is a much simpler
> language).

I tested on two laptops (Ubuntu and Mac OSX). I compiled the two 
languages' standard libraries by using the provided makefiles, after 
touching all .go and all .d files involved. Then I divided the 
compilation times by the line counts of *.go/*.d files as wc has them 
and compared the results.

On OSX dmd was 4.3 times faster. On Ubuntu, the ratio was 4.45.

I had an online demo prepared for the talk, but I decided to not use it.


Andrei


More information about the Digitalmars-d mailing list