Is dmd fast?

qznc via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 22 07:28:28 PDT 2016


On Wednesday, 22 June 2016 at 14:11:12 UTC, Jack Stouffer wrote:
> On Wednesday, 22 June 2016 at 13:46:50 UTC, qznc wrote:
>> ...
>
> Including scripting languages in that example is unfair as they 
> only lex the file.

Sure. Especially bash, which is always in RAM anyways. It shows 
the possible span, though.

> Right away you can tell that "Hello World" is a poor example of 
> fast compile times because GCC is near the top; (as you 
> probably know) large Cpp projects can have half hour to an hour 
> long build times. Large projects are way faster to compile 
> using dmd.

This is the C hello world. I added a C++ one and it is slightly 
faster than Go.

I completely agree that Hello World is poor. Brainfuck is a 
little better.

> Using the code from even a small piece of code that does 
> something real, all of a sudden the numbers get a lot closer. 
> Here is the code I'm using: 
> https://github.com/kostya/benchmarks/tree/master/brainfuck2
>
> $ time rustc bf.rs
> rustc bf.rs  0.29s user 0.05s system 99% cpu 0.350 total
>
> $ time go build bf.go
> go build bf.go  0.46s user 0.07s system 128% cpu 0.416 total
>
> $ time dmd bf.d
> dmd bf.d  0.32s user 0.09s system 73% cpu 0.556 total
>
> $ time g++ bf.cpp
> g++ bf.cpp  0.36s user 0.36s system 65% cpu 1.093 total

Rust faster than Go? That still seems weird.

I like your overall benchmark. Measuring build times there seems 
like a good idea.


More information about the Digitalmars-d mailing list