Before we continue, let's understand the difference between bytecode and machine code (native code).
Machine code ( aka native code )
Machine code — it is a set of instructions that are directly executed by the processor. Each instruction performs a unique task, such as loading or logical operation on data in processor memory. Almost all high-level languages such as C translate source code into executable machine code using compilers, loaders, and linkers. Each processor or processor family has its own set of machine code instructions.
Bytecode is also a binary representation executed a virtual machine (not a processor directly). A virtual machine (which is written differently for different machines) converts a binary instruction into a specific machine instruction. One of the languages that use the concept of bytecode is Java.
Machine code is much faster compared to Bytecode, but Bytecode is portable and safe compared to Machine Code.
Python implementation written in C #, designed for the Microsoft .NET framework. Similar to Jython, it uses a .Net virtual machine i.e. common language runtime . IronPython can use the .NET Framework and Python libraries, and other .NET languages can use Python code very efficiently. IronPython performs better in Python programs using threads or multiple cores because it has a JIT and also because it doesn't have a global interpreter locks .
"If you want your code to run faster, you should probably just use PyPy." — Guido van Rossum (creator of Python)
Python — it is a dynamic programming language. Python is said to be slow as the default CPython implementation compiles python source code to bytecode which is slower compared to machine code (native code). This is where PyPy comes in.
PyPy is an implementation of the Python programming language written in Python. The interpreter is written in RPython (a subset of Python).
PyPy uses ( just-in-time build ). Simply put, JIT uses compilation techniques to make the interpreter system more efficient and faster. So basically JIT allows you to compile your source code to machine code, which makes it very fast.
PyPy also comes with no stack support by default, providing micro-threading for massive parallelism. Python is said to be about 7.5 times faster than Cpython.
Some other Python implementations: CLPython , Pyston strong>, Psyco , Cython , IPython .
This article courtesy of Saurabh Daalia . If you are as Python.Engineering and would like to contribute, you can also write an article using contribute.python.engineering or by posting an article contribute @ python.engineering. See my article appearing on the Python.Engineering homepage and help other geeks.
Please post comments if you find anything wrong or if you would like to share more information on the topic discussed above.