narrowed down the problem area

Sergey Gromov snake.scaly at gmail.com
Sat Feb 16 04:51:21 PST 2008


Sergey Gromov <snake.scaly at gmail.com> wrote:
> I'm trying to investigate this issue, too.  I'm comparing the C++ code 
> generated by Visual C Express 2005, and GDC 0.24 based on GCC 3.4.5 and 
> DMD 1.020.  Here's the commented out comparison of unitise() function:

Continuing investigation.  Here are raw results:

>make-cpp-gcc.cmd
gcc -c -O3 -fomit-frame-pointer -fweb -finline-functions ray-cpp.cpp
gcc ray-cpp.o -o ray-cpp.exe -lstdc++

>test-cpp.cmd
ray-cpp  1>ray-cpp.pbm
10968

>make-d.cmd
gdc -c -O3 -fomit-frame-pointer -fweb -frelease -finline-functions ray-
d.d
gdc ray-d.o -o ray-d.exe

>test-d.cmd
ray-d  1>ray-d.pbm
10828

The numbers printed by tests are milliseconds.  As you can see, the D 
version is slightly faster.  The outputs are identical.

C++ and D program is here, respectively:
http://paste.dprogramming.com/dpaftqa2
http://paste.dprogramming.com/dptiniar

The only change in C++ is the time output at the end of the main().  D 
program is refactored so that all struct manipulations happen in-place, 
without passing and returning by value.  GDC has troubles inlining 
static opCalls for some reason.

Microsoft's compiler produces FP/math code about 25% shorter than 
GCC/GDC in average, hence the results:

>make-cpp.cmd
cl -nologo -EHsc -Ox ray-cpp.cpp

>test-cpp.cmd
ray-cpp  1>ray-cpp.pbm
7656

-- 
SnakE



More information about the Digitalmars-d mailing list