Improving performance by using PyPy

Running the scripts with PyPy3 instead of python3 will make the engines run about two or three times as fast, so it is generally recommended to use PyPy.

Below is a sample terminal session that shows how to set up PyPy under Arch Linux and run the PyTuroChamp scripts.

Note that the “–local” command line switch is used here to install pip and python-chess into .local/ in the user’s home directory. This is optional, but perhaps a good idea on Linux. It also means that root permissions are not necessary during installation.

# Install the Python 3 version of PyPy;
#  this command works only on Arch
#  and might be different on your Linux distro:
$ sudo pacman -S pypy3

# Install the pip package manager for PyPy:
$ pypy3 -m ensurepip --user

# Install python-chess:
$ pypy3 -m pip install chess --user

# Show packages installed under PyPy,
#  chess should be there now:
$ pypy3 -m pip list --user
Package      Version
------------ -------
pip          20.2.4
chess        1.2.2
setuptools   50.3.2