[YLUG] Why is this so much faster on an Opteron?
Robert Hulme
rob at robhulme.com
Mon Sep 24 15:21:03 BST 2007
I have this code:
#include <stdio.h>
int main(char **argv,int argc) {
double f=0;
int i=0;
int j=0;
int c=1;
for(i=0;i<10000;i++)
for(j=0;j<10000;j++,c++)
f=f+0.505/(j+i/(1.0+j+i));
return (int)f%10;
}
If I compile it with -O2 it takes about 40 seconds to run on my
Pentium D (dual core pentium 4) desktop, but only about 2 seconds
(when using time) to run on a 2.2Ghz Opteron.
Why is there such an enormous difference?
How long does it take to run on peoples machines?
-Rob
--
http://www.robhulme.com/
http://robhu.livejournal.com/
I think therefore I am an atheist
-- Ryan Evans
More information about the York
mailing list