www.digitalmars.com         C & C++   DMDScript  

D - Re: [Performance] dmd outperforms gcc C and several others in trigonometric functions

Following the benchmark, which can be found under
http://osnews.com/story.php?news_id=5602&page=1
the benchmark tested five criteria:
integer math, long math, double math, trigonometric functions, file io

I only take into account the first four. The unweighted geometric mean
of the quotients of the time needed for the program compiled by dmd and of
the time needed by the program compiled by Visual C++ yields an estimated
performance for dmd of a

        2,59-fold

of the time needed by the reference compiler Visual C++.

The ordered ranking of the used compilers follows:

Visual C++     1
Visual Basic   1.43


gcc C          1.77
Java 1.4.2     2.04
Java 1.3.1     2.58
dmd 0.79(est)  2.59
Python/psyco   8.78
Python        34.1


Now the relative results for gcc and dmd:

            int    long   double  trig      geometric mean
Visual C++  1      1       1      1         1
gcc C       1.021  1.532   1.484  4.257     1.77
dmd(est)    1.039  5.691   3.688  2.074     2.59

The estimated timing results for dmd on the benchmark machine are:

            int    long   double  trig 
dmd(est)    9.97   107    23.6    7.26   (all values in seconds)   

This estimated timing results are calculated by compiling the source code
of the benchmark by the gcc(same version) on my machine and running it. The
runs yield the following timing results `gcc.mine' in seconds for the four
tests:

            int    long   double  trig 
gcc.mine    18.1   46.9   16.6   19.6

Then the code of the benchmark was adopted to the syntax of D and compiled
by dmd 0.79 and run on my machine, yielding the following timing results
`dmd.mine' in seconds for the four tests:

            int    long   double  trig 
dmd.mine    18.4   176    41.3    9.54

The benchmark results from gcc for the four tests are `gcc.rep' in seconds

            int    long   double  trig 
gcc.rep     9.8    28.8   9.5    14.9  

From these  three values the estimated benchmark result for each test is
computed using the formula

      dmd(est) := dmd.mine * gcc.rep / gcc.mine


The values for gcc.mine and dmd.mine where obtained as follows:

compiling the source with 'gcc -march=pentium -mno-cygwin -s -O3' under
cygwin and running it three times on a command prompt on a nearly empty
machine yielded the following:

                               gcc.mine
int:     18130, 18130, 18180 -> 18.1
long:    46850, 46900, 46850 -> 46.9
double:  16640, 16590, 16640 -> 16.6
trig:    19610, 19610, 19670 -> 19.6

compiling the adapted source  with 'dmd -O' and running it three times on a 
comand prompt yielded the following:

                                    d.mine
int:     18410,  18404,  18434 ->  18.4
long:   174497, 174534, 174563 -> 175 
double:  41283,  41278,  41255 ->  41.3
trig:     9537,   9544,   9541 ->   9.5i4



The code of the benchmark is located at:
 http://www.ocf.berkeley.edu/~cowell/research/benchmark/code/


The source adapted for D is not attached because of the existing
copyright of the benchmark creator. The adaption is staright forward.


NOTE:

also gcc was adviced in the original benchmark to make use of the SSE2,
this  seemed not to work. Otherwise dmd should even score better

So long.
Mar 14 2004