www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - gdc and the Computer Language Benchmarks Game

reply Guido Schimmels <schimmi iesy.net> writes:
Hello,

I've been curious last night, how D does in the language shootout:
http://shootout.alioth.debian.org/gp4/

It's reasonably close to C or C++ with dmd - good.
Then I looked where D fares especially bad. 
That's 
a) mandelbrot: factor 2.0 slower than both C and C++ 
and
b) recursive: factor 2.5 slower than C and factor 2.7 slower than C++

So I wanted to know, if gdc makes a difference here -  and boy it does.
mandelbrot.d: gdc beats dmd by factor 1.8
recursive.d: gdc beats dmd by factor 2.22

compiler: dmd-1.015, gdc-0.23, gcc-4.1.1 (i686-linux)
command line: (g)dmd -O -inline -release

So gdc gets those within 5%-10% range of GNU C/C++.
In the mandelbrot case this is especially remarkable, since both the C and C++
code is hand-tweaked for SSE2, while the D code is generic straight-foward fp.

In light of this, gdc compiled D might even end up topping that list.
So I wish the D community makes sure not to miss that opportunity to promote
the language.

Guido
Jun 28 2007
parent reply renoX <renosky free.fr> writes:
Guido Schimmels a écrit :
 Hello,
 
 I've been curious last night, how D does in the language shootout: 
 http://shootout.alioth.debian.org/gp4/
 
 It's reasonably close to C or C++ with dmd - good. Then I looked
 where D fares especially bad. That's a) mandelbrot: factor 2.0 slower
 than both C and C++ and b) recursive: factor 2.5 slower than C and
 factor 2.7 slower than C++
 
 So I wanted to know, if gdc makes a difference here -  and boy it
 does. mandelbrot.d: gdc beats dmd by factor 1.8 recursive.d: gdc
 beats dmd by factor 2.22
 
 compiler: dmd-1.015, gdc-0.23, gcc-4.1.1 (i686-linux) command line:
 (g)dmd -O -inline -release
 
 So gdc gets those within 5%-10% range of GNU C/C++. In the mandelbrot
 case this is especially remarkable, since both the C and C++ code is
 hand-tweaked for SSE2, 
Uh? I thought that it was against the rule of this shootout to do this kind of optimisation? Otherwise, you could include assembly code in a D program and benchmark it as a D program which obviously it isn't.. Regards, renoX
while the D code is generic straight-foward
 fp.
 
 In light of this, gdc compiled D might even end up topping that list.
  So I wish the D community makes sure not to miss that opportunity to
 promote the language.
 
 Guido
Jun 29 2007
parent reply Dave <Dave_member pathlink.com> writes:
renoX wrote:
 Guido Schimmels a écrit :
 Hello,

 I've been curious last night, how D does in the language shootout: 
 http://shootout.alioth.debian.org/gp4/

 It's reasonably close to C or C++ with dmd - good. Then I looked
 where D fares especially bad. That's a) mandelbrot: factor 2.0 slower
 than both C and C++ and b) recursive: factor 2.5 slower than C and
 factor 2.7 slower than C++

 So I wanted to know, if gdc makes a difference here -  and boy it
 does. mandelbrot.d: gdc beats dmd by factor 1.8 recursive.d: gdc
 beats dmd by factor 2.22

 compiler: dmd-1.015, gdc-0.23, gcc-4.1.1 (i686-linux) command line:
 (g)dmd -O -inline -release
On my machine at least, DMD 1.014 performs better than GDC 0.23 for a couple of the other current tests, so it may be a wash in the end. But it would be nice if they'd put GDC up there too.
 So gdc gets those within 5%-10% range of GNU C/C++. In the mandelbrot
 case this is especially remarkable, since both the C and C++ code is
 hand-tweaked for SSE2, 
Uh? I thought that it was against the rule of this shootout to do this kind of optimisation?
It looks like it's done with an intrinsics library, so it's probably right on the edge <g>.
 Otherwise, you could include assembly code in a D program and benchmark 
 it as a D program which obviously it isn't..
 
 Regards,
 renoX
 
 while the D code is generic straight-foward
 fp.

 In light of this, gdc compiled D might even end up topping that list.
  So I wish the D community makes sure not to miss that opportunity to
 promote the language.

 Guido
Jun 29 2007
parent Guido Schimmels <schimmi iesy.net> writes:
Dave Wrote:

 On my machine at least, DMD 1.014 performs better than GDC 0.23 for a couple
of the other current 
 tests, so it may be a wash in the end. But it would be nice if they'd put GDC
up there too.
Ah! Still, D seems to have the potential to lead the pack, which I wouldn't have necessarily expected. Wonder why dmd fouls up so badly with the canonical textbook example. Computes the fibonacci barely faster than Java, juck! DMD struggling with the templates? Guido
Jun 30 2007