What is PyPy?

Mindfire Solutions
3 min readJul 4, 2017

--

The simple and expressive syntax rules of Python enables programmers to express concepts without writing longer line of code. The concise and readable Python source code further help programmers to write and maintain software applications without putting extra time and efforts. But a number of studies have shown that Python is slower than other modern programming languages. That is why; programmers often explore ways to speed up Python source code interpretation.

Many developers opt for alternative implementation of Python to interpret the code written in the programming language more efficiently and quickly. They also have option to choose from a number of Python interpreters including CPython, Jython, IronPython, PyPy and MicroPython. Unlike other interpreters, PyPy is written in Python programming language. A number of studies have shown that PyPy interprets the source code written in Python faster than other interpreters.

Feature that make PyPy Different from Other Python Interpreters

Design

In addition to being written in Python programming language, PyPy further includes an interpreter and a translator. The interpreter written in RPython understands and interprets the Python source code efficiently and quickly. At the same time, the translator used by PyPy translates the RPython code efficiently into a lower-level programming language like C. The combination of the interpreter and translator makes PyPy interpret and execute Python source code must faster than similar interpreters.

Faster Source Code Interpretation

Like other interpreters, PyPy is also designed with features to interpret Python source code efficiently. But PyPy is designed with a Just-in-Time (JIT) compiler. The JIT compiler make PyPy interpret Python source code much faster than other interpreters. The programmers can even use PyPy to execute long-running programs efficiently. But the developers cannot use the interpreter to execute short-running programs quickly.

Reduced Memory Usage

A number of studies have shown that Python is more memory hungry than other modern programming languages. The developers explore ways to reduce memory consumption without affecting the Python application’s performance. PyPy is much lighter than the Python interpreters written in C programming language. Hence, the developers can easily reduce memory consumption by interpreting Python source code with PyPy.

Stackless Mode Support

PyPy is designed with built-in support for stackless mode. As an enhanced version of Python, Stackless Python helps programmers to simplify thread-based programming. While using Stackless Python, the programmers can make the code readable and improve program structure simply by adding micro-threads to the Python code. PyPy makes easier for programmers to enhance the performance of their application by availing various features of Stackless Python including micro-threads, scheduling, channels and serialization.

Compatibility with Existing Python Code

The current version of PyPy is compatible with major operating systems including Windows, Linux, and Mac OS X. Also, it implements Python 2.7.13. At the same time, PyPy supports all core language features of Python and several widely used Python libraries. The developers also have option to try the beta release of PyPy3 which implements Python 3.2.5. Hence, the Python developers can use PyPy to interpret the existing Python source code without making any major modifications.

Secondary Features

As mentioned earlier, PyPy is developed based on RPython. The RPython toolchain is currently being used by an array of technologies including JavaScript, Topaz, HippyVM, Smalltalk, Gameboy, Scheme and Io. Hence, the programmers can use PyPy to interpret the source code written in PHP, Ruby, or JavaScript. Also, PyPy will come in future with a sandboxing feature that will allow programmers to execute untrusted user programs.

On the whole, PyPy is a fast interpreter for Python. It is further written in Python, and designed with features to interpret Python source code more quickly. In addition to being compatible with major operating systems, PyPy further allows programmers to run Python applications seamlessly without relying on any implementation-specific features. Hence, the programmers can use PyPy to take advantage of the simple and expressive syntax rules of Python, while interpreting the source code faster.

--

--

Mindfire Solutions

Mindfire is a software service provider, with unrelenting focus on small-team offshore software development using Agile methods.