0

From my understanding the default Python interpreter (CPython) compiles source code into bytecode and then interprets the bytecode into machine code.

PyPy on the other hand makes use of JIT to optimize often interpreted bytecode into compiled machine code. How is this different then the JVM? The JVM is an interpreter + compiler. It compiles source code to bytecode and then optimizes the often interpreted bytecode into compiled machine code.

Is there any other difference?

Seki
  • 11,135
  • 7
  • 46
  • 70
BubbleTree
  • 566
  • 5
  • 11
  • 23
  • The JVM is a Virtual Machine, not an interpreter + compiler. The Java compiler compiles source code to bytecode. – Leon Jun 02 '15 at 05:26
  • This is really broad. A JVM and PyPy are entirely different programs. They're similar in the broad sense of both running code and both using similar technologies, but there are tons of differences on all sorts of levels. It's like asking what the differences are between two skyscrapers. – user2357112 Jun 02 '15 at 05:29
  • 1
    Not quite the same question, but close enough so that the information should be valuable. http://stackoverflow.com/questions/441824/java-virtual-machine-vs-python-interpreter-parlance – Leon Jun 02 '15 at 05:32

1 Answers1

0

(CPython) compiles source code into bytecode and then interprets the bytecode

  • CPython can eval raw source code but compile it into bytecode for more performance of interpretation.
  • PyPy also interpreter but can translate sourcecode to machine code (or C, JVM-bytecode, CIL).
  • Java compile source code to machine code of JVM. Further JVM run this code inside itself. Also JVM include JIT, which helps JVM convert currently executing byte code into machine code. Read more.
RBT
  • 24,161
  • 21
  • 159
  • 240
Michael Kazarian
  • 4,376
  • 1
  • 21
  • 25
  • According to your answer, there is no difference in PyPy and JVM, since both interpret the bytecode and potentially use JIT for machine code generation. AFAIU CPython is like JVM without JIT – denis631 Jan 22 '19 at 12:22