[Issue 797] New: Performance issue using "release" flag

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 5 23:58:04 PST 2007


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 at digitalmars.com
        ReportedBy: david at 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.


-- 



More information about the Digitalmars-d-bugs mailing list