A JIT powered blitter for Pygame

An attempt to write a JIT powered standalone SDL surface blitter in RPython.


The blitter is implemented as a bytecode interpreter, so the JIT is generated automatically by the RPython toolchain. The C level code is in a C shared library, with no Python level dependencies. It is called through a Python level API implemented using cffi, so can be used by both the PyPy and CPython interpreters.


How to build on Gnu/Linux

From the blitter source directory (assuming a bash shell):

~/blitter $ PYPY_SRC="/path/to/PyPy/source"
~/blitter $ PYTHONPATH="$PYPY_SRC" "$PYPY_SRC/rpython/bin/rpython" -Ojit \

> --gcrootfinder=shadowstack

After the build — it will take a few minutes — copy the shared library from the /tmp subdirectory where it was built to the current directory.

To test:

~/blitter $ py.test

To compare blits times for a 32 bit pygame surface and int32 NumPy array:

~/blitter $ python