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 by david — 2009-10-14T11:53:06Z
Tested with dmd v2.032 and it doesn't seem to be an issue anymore.