title: when is java faster than c++ (or when is JIT faster then precompiled)?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/538056/jit-compiler-vs-offline-compilers">JIT compiler vs offline compilers</a>  </p>
  </blockquote>
  
  
  
  <p>I have heard that under certain circumstances, Java programs or rather parts of java programs are able to be executed faster than the "same" code in C++ (or other precompiled code) due to JIT optimizations. This is due to the compiler being able to determine the scope of some variables, avoid some conditionals and pull similar tricks at runtime.</p>
  
  <p>Could you give an (or better - some) example, where this applies? And maybe outline the exact conditions under which the compiler is able to optimize the bytecode beyond what is possible with precompiled code?</p>
  
  <p><b>NOTE :</b> This question is <b>not</b> about comparing Java to C++. Its about the possibilities of JIT compiling. Please no flaming. I am also not aware of any duplicates. Please point them out if you are.</p>