www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Dhrystone speed dmd vs gdc

reply downs <default_357-line yahoo.de> writes:
I just ran the samples/dhry.d compiled with DMD 1.007 vs GDC .23 svn on gcc
4.1.1 using MinGW, on a Pentium M with 1.6g.
The used flags were -O -release -inline for DMD and -ffast-math -O3 -frelease
-finline-functions for GDC.
The observed VAX MIPS ratings were 3280 for GDC, but only 2570 for DMD.
(Note that the GDC rating could be increased to 3480 by adding -msse
-mfpmath=sse,387, but that is somewhat risky).
All tests were run with realtime priority.
Do you think this difference in a synthetic benchmark translates into an actual
speed difference for real-world applications?
Did I miss any DMD compiler flags?
Greetings   --downs
Feb 24 2007
next sibling parent Manfred Nowak <svv1999 hotmail.com> writes:
downs wrote

 I just ran the samples/dhry.d

Warning! That is a sample only! I remember tests of my own with similar results. But on more careful analysis it turned out, that dhry.d seems to be unusable as a benchmark. AFAIR this was due to some function f() which converges to the value 1.0. GCC's math library allowed that function to reach 1.0, whereas DMD let it stay at 1.0-epsilon. I did not analyse that any further because I am at no means an expert in benchmarking and in addition do not want to explore that field. My impression was though, that because f() was used in some multiplication GCC may have made itself an unfair advantage: multiplication with 1.0 seems to be much easier (and therefore faster!) than multiplication with 1.0-epsilon. -manfred
Feb 24 2007
prev sibling parent reply Dave <Dave_member pathlink.com> writes:
downs wrote:
 I just ran the samples/dhry.d compiled with DMD 1.007 vs GDC .23 svn on gcc
4.1.1 using MinGW, on a Pentium M with 1.6g.
 The used flags were -O -release -inline for DMD and -ffast-math -O3 -frelease
-finline-functions for GDC.
 The observed VAX MIPS ratings were 3280 for GDC, but only 2570 for DMD.
 (Note that the GDC rating could be increased to 3480 by adding -msse
-mfpmath=sse,387, but that is somewhat risky).
 All tests were run with realtime priority.
 Do you think this difference in a synthetic benchmark translates into an
actual speed difference for real-world applications?
 Did I miss any DMD compiler flags?
 Greetings   --downs

The DMD version maybe using a higher resolution timer -- GetTickCount() vs time() for the GDC version. If so, that may have a lot to do with it. On a P4 linux box, if I use an external timer ('time'), DMD consistently outperforms GDC with the switches above by about 15% or so.
Feb 24 2007
parent reply downs <default_357-line yahoo.de> writes:
Dave Wrote:

 downs wrote:
 I just ran the samples/dhry.d compiled with DMD 1.007 vs GDC .23 svn on gcc
4.1.1 using MinGW, on a Pentium M with 1.6g.
 The used flags were -O -release -inline for DMD and -ffast-math -O3 -frelease
-finline-functions for GDC.
 The observed VAX MIPS ratings were 3280 for GDC, but only 2570 for DMD.
 (Note that the GDC rating could be increased to 3480 by adding -msse
-mfpmath=sse,387, but that is somewhat risky).
 All tests were run with realtime priority.
 Do you think this difference in a synthetic benchmark translates into an
actual speed difference for real-world applications?
 Did I miss any DMD compiler flags?
 Greetings   --downs

The DMD version maybe using a higher resolution timer -- GetTickCount() vs time() for the GDC version. If so, that may have a lot to do with it. On a P4 linux box, if I use an external timer ('time'), DMD consistently outperforms GDC with the switches above by about 15% or so.

18,219s for GDC vs 22,422s for DMD. So the difference seems less, but it's still there.
Feb 25 2007
parent reply Dave <Dave_member pathlink.com> writes:
downs wrote:
 Dave Wrote:
 
 downs wrote:
 I just ran the samples/dhry.d compiled with DMD 1.007 vs GDC .23 svn on gcc
4.1.1 using MinGW, on a Pentium M with 1.6g.
 The used flags were -O -release -inline for DMD and -ffast-math -O3 -frelease
-finline-functions for GDC.
 The observed VAX MIPS ratings were 3280 for GDC, but only 2570 for DMD.
 (Note that the GDC rating could be increased to 3480 by adding -msse
-mfpmath=sse,387, but that is somewhat risky).
 All tests were run with realtime priority.
 Do you think this difference in a synthetic benchmark translates into an
actual speed difference for real-world applications?
 Did I miss any DMD compiler flags?
 Greetings   --downs

version. If so, that may have a lot to do with it. On a P4 linux box, if I use an external timer ('time'), DMD consistently outperforms GDC with the switches above by about 15% or so.

18,219s for GDC vs 22,422s for DMD. So the difference seems less, but it's still there.

Hmmm - maybe something to do with MinGW / Pentium M? Also I have GCC v4.0.3, gdc 0.21 installed but I don't think it would make that big of diff (not a complete reversal of the results anyway)?? Here's what I get: # dmd -O -inline -release dhry -ofdhry_dmd; for x in 1 2 3; do time dhry_dmd >/dev/null; done gcc dhry.o -o dhry_dmd -m32 -lphobos -lpthread -lm real 0m2.221s user 0m2.200s sys 0m0.008s real 0m2.421s user 0m2.408s sys 0m0.004s real 0m2.299s user 0m2.288s sys 0m0.000s # gdc -ffast-math -O3 -frelease -finline-functions -msse -mfpmath=sse dhry.d -o dhry_gdc; for x in 1 2 3; do time dhry_gdc >/dev/null; done real 0m2.827s user 0m2.816s sys 0m0.004s real 0m2.827s user 0m2.812s sys 0m0.004s real 0m2.802s user 0m2.788s sys 0m0.000s I'll see about upgrading gdc (something I've been meaning to do anyhow) and check it out...
Feb 25 2007
parent Dave <Dave_member pathlink.com> writes:
Dave wrote:
 downs wrote:
 Dave Wrote:

 downs wrote:
 I just ran the samples/dhry.d compiled with DMD 1.007 vs GDC .23 svn 
 on gcc 4.1.1 using MinGW, on a Pentium M with 1.6g.
 The used flags were -O -release -inline for DMD and -ffast-math -O3 
 -frelease -finline-functions for GDC.
 The observed VAX MIPS ratings were 3280 for GDC, but only 2570 for DMD.
 (Note that the GDC rating could be increased to 3480 by adding -msse 
 -mfpmath=sse,387, but that is somewhat risky).
 All tests were run with realtime priority.
 Do you think this difference in a synthetic benchmark translates 
 into an actual speed difference for real-world applications?
 Did I miss any DMD compiler flags?
 Greetings   --downs

GetTickCount() vs time() for the GDC version. If so, that may have a lot to do with it. On a P4 linux box, if I use an external timer ('time'), DMD consistently outperforms GDC with the switches above by about 15% or so.

18,219s for GDC vs 22,422s for DMD. So the difference seems less, but it's still there.

Hmmm - maybe something to do with MinGW / Pentium M? Also I have GCC v4.0.3, gdc 0.21 installed but I don't think it would make that big of diff (not a complete reversal of the results anyway)?? Here's what I get: # dmd -O -inline -release dhry -ofdhry_dmd; for x in 1 2 3; do time dhry_dmd >/dev/null; done gcc dhry.o -o dhry_dmd -m32 -lphobos -lpthread -lm real 0m2.221s user 0m2.200s sys 0m0.008s real 0m2.421s user 0m2.408s sys 0m0.004s real 0m2.299s user 0m2.288s sys 0m0.000s # gdc -ffast-math -O3 -frelease -finline-functions -msse -mfpmath=sse dhry.d -o dhry_gdc; for x in 1 2 3; do time dhry_gdc >/dev/null; done real 0m2.827s user 0m2.816s sys 0m0.004s real 0m2.827s user 0m2.812s sys 0m0.004s real 0m2.802s user 0m2.788s sys 0m0.000s I'll see about upgrading gdc (something I've been meaning to do anyhow) and check it out...

Using gdc 0.23 & gcc 4.1.1, and DMD v1.007 (slight improvement for gdc, but DMD is still a tad faster on my P4 2.2 Ghz, FC5 machine): # dmd -O -inline -release dhry -ofdhry_dmd; for x in 1 2 3; do time dhry_dmd >/dev/null; done gcc dhry.o -o dhry_dmd -m32 -lphobos -lpthread -lm real 0m2.297s user 0m2.288s sys 0m0.000s real 0m2.223s user 0m2.212s sys 0m0.004s real 0m2.310s user 0m2.300s sys 0m0.000s # gdc -ffast-math -O3 -frelease -finline-functions -msse -mfpmath=sse dhry.d -o dhry_gdc; for x in 1 2 3; do time dhry_gdc >/dev/null; done real 0m2.598s user 0m2.584s sys 0m0.000s real 0m2.595s user 0m2.580s sys 0m0.004s real 0m2.640s user 0m2.620s sys 0m0.004s
Mar 08 2007