1. Lenard Lindstrom
  2. blitter


blitter /

Filename Size Date modified Message
55 B
48 B
1.3 KB
640 B
349 B
4.5 KB
204 B
208 B
8.2 KB
1.2 KB
164 B
2.1 KB
1.3 KB
216 B
5.1 KB
867 B
2.9 KB
7.5 KB

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 targetblittershared.py

After the build — it will take a few minutes — copy the libtesting.so 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 blitprof.py