>> Nope. With JIT compilation, a JVM can actually beat C++
>
> This seems a controversial statement to make. I have seen this come up
> time and again at various blog posts all trying convince one thing
> over the other.

Even if the raw CPU speed of Java is slightly less than C++, it is
highly possible that the Java version runs faster compared to C++
version if a reasonably complex program if written both in C++ and
Java.

Java/JVM has some advantages.
* Since Java supports garbage collection, objects can be passed across
libraries without worrying about who should free it. Many times in
C++, unnecessary copies are made at library boundaries.
* JVM does memory compaction to avoid memory defragmentation. In C++,
you have to live with it. memory fragmentation might also mean more
cache misses and more page faults.
* It is possible that JVM can move objects around for better cache
accessibility. (I'm not sure if JVM does it, but it is certainly
possible).

Anand
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to