D for scientific computing

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Jan 25 11:46:01 PST 2013


On Fri, Jan 25, 2013 at 05:50:21PM +0100, John Colvin wrote:
> On Friday, 25 January 2013 at 16:09:00 UTC, H. S. Teoh wrote:
[...]
> >Conclusions:
> >- The performance gap is smaller than previously thought, but it's
> >  still present.
> >- I will be using -inline with dmd aggressively.
> >- What other dmd options am I missing that will bring dmd on par
> >  with gdc -O3 (if there are any)?
> >
> >
> >T
> 
> I have sometimes found that using -release and -noboundscheck made a
> bigger difference to dmd than to gdc. The corresponding gdc options
> are -frelease and -fno-bounds-check
> 
> Comparing performance without -release isn't that meaningful.

Alright. So to make the comparison fair(er), I recompiled test program
#1 (iterating 2-variable function on grid) with:

	dmd -O -inline -m64 -release -nobounds check
	gdc -O3 -m64 -frelease -fno-bounds-check

Here are the new results for test program #1, using n=600:

	With DMD: 15 seconds (average of 4 runs)
	With GDC: 11 seconds (average of 4 runs)

There's still a 36% performance difference.

I did the same thing for test program #2 (terrain generation
simulation), using seed=380170304, with wind & water simulation, and
n=30 (I increased the iteration count to make measurement noise less
prominent). Here's the new results:

	With DMD: 11 seconds (average of 4 runs)
	With GDC: 9 seconds (average of 4 runs)

So a gap of 22% is still present.

I'm running into a DMD bug for test program #3 (linker error when
compiling with -release -O -noboundscheck -inline), so I don't have the
test results for that yet. I'll try to figure out what's causing the
linker error and post the results later.

In the meantime, it's clear that GDC is still showing significant
performance improvement over DMD.  There is a _consistent_ 20-30%
difference in performance in all of the tests so far. So I think at this
point it's fair to say that GDC's back end produces superior code in
terms of performance.  (I will note, though, that GDC produces larger
executables than DMD, sometimes much larger, so space-wise, there is
some price to pay.)


T

-- 
Chance favours the prepared mind. -- Louis Pasteur


More information about the Digitalmars-d mailing list