D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 797 - Performance issue using "release" flag
Summary: Performance issue using "release" flag
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2007-01-06 01:57 UTC by David Ferenczi
Modified: 2014-02-15 13:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Ferenczi 2007-01-06 01:57:59 UTC
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.
Comment 1 David Ferenczi 2009-10-14 11:53:06 UTC
Tested with dmd v2.032 and it doesn't seem to be an issue anymore.