Why DMD is so slow?

Saaa empty at needmail.com
Mon Jun 2 18:07:39 PDT 2008


This outputs ~2660ms on my pentium 4.
Try profiling your code, or comparing the asm.

------------------

auto timer = new PerformanceCounter;
timer.start();

 cdouble a, b, c, z;
 double mand_re = 0, mand_im = 0;

 for (double y = -2; y < 2; y += 0.01) {
  for (double x = -2; x < 2; x += 0.01) {
   z = (x + mand_re) + (y + mand_im) * 1i;
   c = z;
   for (int i = 0; i < 10000; i++) {
    z = z * z + c;
    if(z.re * z.re + z.im * z.im > 4.0) {
     break;
    }
   }
  }
 }

timer.stop();
int elapsedMsec = timer.milliseconds;
writefln("Time elapsed: %s msec", elapsedMsec); 




More information about the Digitalmars-d-learn mailing list