title: Why is it that bytecode might run faster than native code
body: <p>Java is slow.</p>
  
  <p>That's more than an "urban legend", it seems to be a fact.  You don't use it for live-coding because of latency and you don't use it for clusters/parallel computing. There are thousands of benchmarks out there, specially "Java vs C# vs C++".</p>
  
  <p><a href="http://benchmarksgame.alioth.debian.org/" rel="nofollow noreferrer">http://benchmarksgame.alioth.debian.org/</a></p>
  
  <p>According to the above site, not only is Java performance almost as good as C (far from the rest), but Scala and Clojure (both functional languages which runs on the JVM) both have a better performance that OCaml, Erlang.</p>
  
  <p>And there are a lot of "Java is faster then X" out there, also (for instance, a question here on SO: <a href="https://stackoverflow.com/questions/1984856/java-runtime-performance-vs-native-c-c-code">Java Runtime Performance Vs Native C / C++ Code?</a>).</p>
  
  <p>So Java seems to be fast, for certain cases. Can someone explain why?</p>
  
  <p>Why is it that bytecode might run faster then native code, in some cases, given dynamic code (Scala, Clojure) and garbage collection?  How come if it is faster, there is still latency?</p>
  
  <p>It seems to be a contradiction here, can someone shed light?</p>