I don't want to change this code, I'm only interested in JVM, OS or kernel customization/configuration for best results!
I have one second loop (1000 x 1ms)
public static void main(String[] args) throws InterruptedException {
long start = System.nanoTime();
for (int i = 0; i < 1000; i++ ) {
Thread.sleep(TimeUnit.MILLISECONDS.toMillis(1));
}
long duration = System.nanoTime() - start;
System.out.println("Loop duration " +
duration / TimeUnit.MILLISECONDS.toNanos(1) + " ms.");
}
On my Fedora 20 with kernel 3.12 this loop needs 1055 ms.
This is pretty good result, average is more than 1100ms.
Is possible to make this code faster with custom JVM flags or OS configuration?
Loop duration 1055 ms.