I have made a simple loop in Java just to test the speed. Compared to the same loop in C it takes a lot more time. 2 billion iterations takes about 6.5 seconds when its executed
If its considered to be slow - what could one do to improve the performance?
Could one blame the startup of the JVM? Or - is the JIT-compiler not doing its job?
- platform: windows xp
processor speed: 3.4 GHz
public class Jrand { public static void main (String[] args) { float f; long startTime = System.currentTimeMillis(); for (int i = 0; i < 2000000000; i++) { f = i * 0.0001F; } long endTime = System.currentTimeMillis(); float totalTime = (endTime - startTime); System.out.println("time: " + totalTime/1000); } }