www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 797] New: Performance issue using "release" flag

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=797

           Summary: Performance issue using "release" flag
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: david ferenczi.net


I encountered some interesting performance differences in case of using release
flag.

The code (test_d.d):
----------------------------8<--------------------------------
int main()
{
    const int arraySize = 30000;
    int[arraySize] myArray;
    for (int i = 0; i < arraySize; i++)
    {
        myArray[i] = i * i % 33;
    }
    for (int i = 0; i < arraySize; i++)
    {
        for (int j = i + 1; j < arraySize; j++)
        {
            myArray[(i+j)%arraySize] = (i + myArray[i] + myArray[j] * 17) % 33;
        }
    }
    return 0;
}
----------------------------8<--------------------------------

The tests I made:

$ dmd-1.00 test_d.d
gcc test_d.o -o test_d -m32 -lphobos -lpthread -lm -Xlinker -L/opt/dmd/1.00/lib

$ time ./test_d

real    0m21.365s
user    0m19.369s
sys     0m0.236s

$ dmd-1.00 -release test_d.d
gcc test_d.o -o test_d -m32 -lphobos -lpthread -lm -Xlinker -L/opt/dmd/1.00/lib

$ time ./test_d

real    0m29.500s
user    0m29.058s
sys     0m0.344s

$ dmd-1.00 -O test_d.d
gcc test_d.o -o test_d -m32 -lphobos -lpthread -lm -Xlinker -L/opt/dmd/1.00/lib

$ time ./test_d

real    0m17.109s
user    0m16.857s
sys     0m0.200s

$ dmd-1.00 -O -release test_d.d
gcc test_d.o -o test_d -m32 -lphobos -lpthread -lm -Xlinker -L/opt/dmd/1.00/lib

$ time ./test_d

real    0m28.653s
user    0m28.142s
sys     0m0.352s

Using the release flag I got dramatical worse performance. I also tested with
dmd v0.173 and got the same results.


-- 
Jan 05 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=797


David Ferenczi <david ferenczi.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



---
Tested with dmd v2.032 and it doesn't seem to be an issue anymore.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2009