Python and PyPy on Raspberry Pi 1 nad 2 – Benchmarks

The new Raspberry Pi is out. How fast is it? About 6x they say, 6x using 4 cores! What about one core? How fast will your code run? Let’s use The Grand Unified Python Benchmark Suite and check it. What is it?

This project is intended to be an authoritative source of benchmarks for all
Python implementations. The focus is on real-world benchmarks, rather than
synthetic benchmarks, using whole applications when possible.

Where to get the benchmarks?

Benchmarking is hard, showing the results in easy and readable way is even harder. So don’t trust me. Try it yourself. You can get all benchmarks from python mercurial repo via

or, if you don’t have mercurial installed, you can download zip file

This tests are designed to compare different python implementations. Python actually has many implementations, here are the four most popular:

  • cpython – implemented in C, probably you are using it
  • jython – implemented in java
  • ironpython – implemented in C#
  • pypy

What is PyPy?

PyPy is a replacement for CPython. It is built using the RPython language that was co-developed with it. The main reason to use it instead of CPython is speed: it runs generally faster

Read more on their site

Before running the benchmarks you need to install PyPy. If you are using Rasbian just run:

Using this command you will install PyPy 2.2. The newest version is PyPy 2.5, which you can download here, there is even version for Rasbian.

How to run the benchmarks?

Running this benchmarks on Raspberry Pi 1 will take almost 20 hours.

To start benchmarks just run:

How long does it take to run?

  • Raspberry Pi 1 – 19.5h
  • Raspberry Pi 2 – 6h
  • My laptop with i7 2.7GHz CPU – 20 minutes

It looks like just switching to Raspberry Pi 2 may speed up your code about 3.3 times. And there are still 3 more cores waiting for you!

The benchmarks


The above plot represents Python on Raspberry Pi 2 benchmark times normalized to Raspberry Pi1. Smaller is better.
Depending on workflow it looks like you code may be even 3.5x faster. On geometrical average it’s 2.93x faster.


The above plot represents PyPy on Raspberry Pi 2 benchmark times normalized to Raspberry Pi1. Smaller is better.
If you are using PyPy, switching to new Raspberry will give you even better improvement. On geometrical average it’s 3.29x faster.

PyPy 2.2 vs PyPy 2.5

By default on Rasbian you can install version 2.2 and the current version is 2.5. Does it make sense to use newest version?

In some cases it makes sense. On geometrical average it’s 1.23x faster and in one case it’s even 2.5x faster.

Pypy vs Python on Pi 2

PyPy is faster than the most popular C implementation, at least this is what we can see on their site: It should be almost 7x faster, but is it?

Using this particular tests on geometrical average PyPy 2.5 is only 1.15x faster than Python. Unfortunately it’s not that easy. In some tests PyPy is 4.5x faster but in other almost 4x slower. When should you use it? PyPy guys have  a great page on their site where you can read when PyPy is slow and when it’s amazingly fast.

Another benchmarks

Do you want to see more RaspberryPi 2 benchmarks? Here you go:

There is a blog post on Raspberry Pi site with some benchmarks. Adafriut made a great overview of new Pi with some good benchmarks. LinuxVoice has a nice overview with some performance tests.  Alex Eames made nice video with power and performance measurements. On Hackady you can also see some nice benchmarks. Purbeck STEM club made really nice Minecraft “benchmark” with many BUMs and BAMs. What about database performance? Go and see this post from Nigel Day on Raspberry Pi forum. Trusted Reviews also has interesting article about Pi performance.

Next ArticlePython libraries - RPi.GPIO