PyHaskell benchmark suite


PyHaskell is a (work in progress) Haskell implementation written in RPython. The PyHaskell VM is a backend for GHC, converting GHC's external Core into a JSON representation, which it then parses and evaluates.

This benchmark suite contain mostly micro-benchmarks that can be used on PyHaskell with the help of the runner.py Python module. See Benchmarks.

The bin/ folder has different versions of PyHaskell translated to C with the RPython translation toolchain from the PyPy project. Some of them contain the RPython meta-tracing just-in-time compiler. See PyHaskell versions.

Dependencies and installation

Download the following dependencies:

  1. PyPy source code
  2. PyHaskell source code
  3. Glasgow Haskell Compiler 7.4.2
  4. Python 2.7
  5. The LLVM Compiler Infrastructure (optional)
  6. json
  7. extcore

Install GHC and Python, and add PyPy and PyHaskell to PYTHONPATH env variable. LLVM is required for GHC's LLVM backend. The last two items, Haskell packages required by PyHaskell, can be installed with cabal.


The src/ folder contains the following benchmarks:

  • addition - very simple interger addition
  • fibonacci - the naive fibonacci implementation
  • TODO

PyHaskell versions

The bin/ folder has different versions of PyHaskell translated to C. The following table list the different versions and their source repository revisions.

PyHaskell version PyHaskell revision PyPy revision Note
v1 0152989a42b1 07e08e9c885c No elidable
v2 3841970a6bdd 07e08e9c885c Elidable get_var
v3 94f068808666 07e08e9c885c Unboxed Cons#
v4 60e16de1181f 07e08e9c885c  
v5 60e16de1181f 07e08e9c885c  

Benchmark-runner usage

usage: runner.py [-h] [-t [TV]] [-n [NUM]] [-v] [-p] [-z] [-c]
[target] [benchmark [benchmark ...]]

Run PyHaskell benchmarks.

positional arguments:
target target binary to benchmark benchmark a specific benchmark to run
optional arguments:
-h, --help show this help message and exit

-t [TV], --tv [TV] PyHaskell target version -n [NUM], --num [NUM]

number of times to repeat benchmark
-v, --verbose print detailed information
-p, --priority run benchmark at highest priority, require root
-z, --zdecode create z-decoded hcr file of benchmark
-c, --count count operations in jit trace-log

The runner report context switches and waits if the --verbose cli flag is given, and there are any context switches or waiting during benchmarking. The runner also set process priority to 99 if the --priority cli flag is given, which may require root.


PyHaskell-benchmarks are licensed under the MIT license. See separate LICENSE.txt.