my first D program (and benchmark against perl)

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 11 09:32:46 PST 2015


On Wednesday, 11 November 2015 at 16:02:07 UTC, H. S. Teoh wrote:
> If performance is a problem, my first reaction would be to try 
> GDC or LDC.  While there have been recent improvements in DMD 
> code generation quality, it still has a ways to go to catch 
> with GDC/LDC's optimizer.
>
>
> T

My computer seems to agree (note that I did those a bunch of time 
with
intermediate rounds to heat the cache, these numbers are only to 
give
a rough idea):

$time rdmd --compiler=ldc test.d
|row1.1|row1.2  |row1.3  |
|row2.1|row2.2  |row2.3  |
|row3.1|row3.2  |row3.3  |
|row4.1|row4.2  |row4.3  |
|row5.1|row5.2  |row5.3  |
rdmd --compiler=ldc test.d  6.07s user 0.10s system 99% cpu 6.177 
total

$time rdmd --compiler=dmd test.d
|row1.1|row1.2  |row1.3  |
|row2.1|row2.2  |row2.3  |
|row3.1|row3.2  |row3.3  |
|row4.1|row4.2  |row4.3  |
|row5.1|row5.2  |row5.3  |
rdmd --compiler=dmd test.d  21.21s user 0.09s system 97% cpu 
21.919 total

$time ./test.pl
|row1.1|row1.2  |row1.3  |
|row2.1|row2.2  |row2.3  |
|row3.1|row3.2  |row3.3  |
|row4.1|row4.2  |row4.3  |
|row5.1|row5.2  |row5.3  |
./test.pl  13.71s user 0.00s system 99% cpu 13.715 total


With optimization on it is better but still not enough for dmd:


$time rdmd --compiler=ldc -inline -release -O test.d
|row1.1|row1.2  |row1.3  |
|row2.1|row2.2  |row2.3  |
|row3.1|row3.2  |row3.3  |
|row4.1|row4.2  |row4.3  |
|row5.1|row5.2  |row5.3  |
rdmd --compiler=ldc -inline -release -O test.d  4.99s user 0.09s 
system 98% cpu 5.170 total

$time rdmd --compiler=dmd -inline -release -O test.d
|row1.1|row1.2  |row1.3  |
|row2.1|row2.2  |row2.3  |
|row3.1|row3.2  |row3.3  |
|row4.1|row4.2  |row4.3  |
|row5.1|row5.2  |row5.3  |
rdmd --compiler=dmd -inline -release -O test.d  12.67s user 0.06s 
system 99% cpu 12.736 total



More information about the Digitalmars-d-learn mailing list