Speed of Execution | Sololearn: Learn to code for FREE!

+1

Speed of Execution

Why is Python slower than Java?

7/30/2019 7:42:20 PM

SAMSON KIBROM OKBAY

3 Answers

New Answer

+2

Both Java and Python are Byte compiled interpreted/JIT compiled languages. The code is first byte compiled then interpreted or JIT (Just In Time) compiled by the virtual machine (JVM for Java and P(Python)VM for Python). The difference comes due to the fact that Java is a statically typed language as a result the compiler generate efficient byte code as it knows the data types, their sizes and memory requirements before hand, so the compiler can optimize the byte code. Python is dynamically typed language, the data types and memory requirement is not known till runtime as a result the byte code is not that efficient. This is simplified explanation the actual process is much more complex.

+2

because it is an interpreted language, not a compiled one

+2

Python also has a way to do bytecode. So the difference has to run deeper, right?