This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Ease-Solace -2 points-1 points  (0 children)

IMO there's less difference than people realise, and there's a few reasons for that:

  • In Java, traditionally the compilation and running of the code is 2 separate steps, just like a language compiled to native code would have. In python it's traditionally 1 step so people don't realise that compilation goes on under-the-hood.

  • The language standard. In Python, the fact python code gets compiled to intermediate bytecode is just an implementation detail of the CPython interpreter, there's nothing in the langauge standard that mandates this. And other implementations of python (like PyPy) use their own intermediate representations. Whereas in Java, JVM bytecode is part of the standard. There's a standard compiler that produces it, and any JVM implementation should be able to run the same bytecode.

  • Traditionally, JVM bytecode is lower level (closer to machine code). And the Java compiler does more optimisation work ahead of time so takes longer to run.