Hello,

I was evaluating using D for some numerical stuff. However I was surprised to
find that looping & array indexing was not very speedy compared to
alternatives (gcc et al). I was using the DMD2 compiler on mac and windows,
with -O -release. Here is a boiled down test case:

        void main (string[] args)
        {
                double [] foo = new double [cast(int)1e6];
                for (int i=0;i<1e3;i++)
                {
                        for (int j=0;j<1e6-1;j++)
                        {
                                foo[j]=foo[j]+foo[j+1];
                        }
                }
        }

Any ideas? Am I somehow not hitting a vital compiler optimization? Thanks for
your help.

Reply via email to