Hello, I execute this simple program on win7 and win8 in 32 bits and 64bits
why the 64 bits version is significantly slower than 32 bits? It is 3 times slower on double and float...
Am I doing something wrong?
Thanks
w
Win 8 (64 bits) , app compile in 32 bits:
double: milliseconds: 1281.3019
float: milliseconds: 1284.5283
Win 8 (64 bits), app compile in 64 bits:
double: milliseconds: 3453.2643
float: milliseconds: 3484.5163
public static void doubleTest(int loop)
{
Console.Write("double: ");
for (int i = 0; i < loop; i++)
{
double a = 1000, b = 45, c = 12000, d = 2, e = 7, f = 1024;
a = Math.Sin(a);
b = Math.Asin(b);
c = Math.Sqrt(c);
d = d + d - d + d;
e = e * e + e * e;
f = f / f / f / f / f;
}
}
public static void floatTest(int loop)
{
Console.Write("float: ");
for (int i = 0; i < loop; i++)
{
float a = 1000, b = 45, c = 12000, d = 2, e = 7, f = 1024;
a = (float)Math.Sin(a);
b = (float)Math.Asin(b);
c = (float)Math.Sqrt(c);
d = d + d - d + d;
e = e * e + e * e;
f = f / f / f / f / f;
}
}
{
DateTime time = DateTime.Now;
doubleTest(5 * 10000000);
Console.WriteLine("milliseconds: " + (DateTime.Now - time).TotalMilliseconds);
time = DateTime.Now;
floatTest(5 * 10000000);
Console.WriteLine("milliseconds: " + (DateTime.Now - time).TotalMilliseconds);
}
w.