これはある記事で読みました。しかし、ここで与えられた答えは明確ではありません..
1. is it true?
2. Can anyone explain it better?
3. Is there a document that explains java / JVM caching mechanism overall?
**Which one is faster in Java ?**
for(int i = 100000; i > 0; i--) {}
for(int i = 1; i < 100001; i++) {}
Answer: Which ever is run second with be fastest. The server JVM can detect and
eliminate loops which don't do anything. A method with either loop is compiled when
the loop iterates about 10,000 times. (Based on -XX:CompileThreshold=10000) The first
loop will take time to detect it doesn't do anything, however the second will have been
compiled.