Why is my simple Java programm runs quickly on my local computer and too slow on Windows 2008 Server?
Programm code:
public static void main(String[] args) {
long startTime;
long endTime;
long totalTime;
startTime = System.currentTimeMillis();
for (int a=1; a < 100000; a++) {
System.out.println("Checking");
}
endTime = System.currentTimeMillis();
totalTime = endTime - startTime;
System.out.println("TEST1 time:"+totalTime);
startTime = System.currentTimeMillis();
double sum = 0;
for (int a=1; a < 1000000; a++) {
int input = 100;
for(int counter=1;counter<input;counter++){
sum += Math.pow(-1,counter + 1)/((2*counter) - 1);
}
}
endTime = System.currentTimeMillis();
totalTime = endTime - startTime;
System.out.println("TEST2 time:"+totalTime+" pi="+sum);
}
Local computer output:
Checking
Checking
Checking
Checking
TEST1 time:427
TEST2 time:7261 pi=787922.5634628027
Windows server output:
Checking
Checking
Checking
Checking
Checking
Checking
TEST1 time:15688
TEST2 time:25280 pi=787922.5634628027
Local computer hardware and soft: Intel Core (TM) i7-2600 CPU @ 3.40GHz Windows 7 Professional 8G RAM
Server hardware and soft:
Intel Xeon(R) CPU E5-2603 @ 1.60GHz 8G RAM Windows Server 2008 Standart Version 6.0
Both computer and server are free from another processes.
May be I have to apply some parametrs to java vm?