Hacker News new | ask | show | jobs
by j16sdiz 1439 days ago
In many C/C++ optimizing compiler, this is replaced with `counter = 1000;`.

I have no idea how java handle this.. Does the AOT compiler do any optimization? Would this defer to the JIT?

1 comments

There is aot native compilation in javaland these days, but I assume you mean javac, the compiler that transforms source into jvm bytecode. It defers pretty much all optimization to the JITs and won't remove empty loops.
No, but in this case, the JIT will get rid of this empty loop.