Prerequisites and Tooling

This page focuses on practical environment setup for accurate, reproducible benchmark runs.

Python and Virtual Environment

Use Python 3.8+ and isolate dependencies in a virtual environment:

python -m venv .venv
# Linux/macOS
source .venv/bin/activate
# Windows PowerShell
.venv\Scripts\Activate.ps1

pip install -U pip
pip install -e .

PyPy Setup for Method Comparison

PGSI compares cpython and pypy execution paths. Install PyPy and provide its executable path.

Windows

  1. Download the latest PyPy3 Windows build from the official downloads page.

  2. Extract it to a stable location (example: C:\tools\pypy3).

  3. Set environment variable:

$env:PGSI_PYPY_PATH="C:\tools\pypy3\pypy3.exe"

Linux/macOS

Install via package manager or download binary release, then point PGSI to the executable:

export PGSI_PYPY_PATH=/opt/pypy/bin/pypy3

GCC / C Compiler Setup for ctypes and cython

To benchmark native paths (ctypes/cython), a C compiler must be available.

Linux

sudo apt update
sudo apt install -y build-essential
export PGSI_CC_PATH=/usr/bin/gcc

macOS

xcode-select --install
export PGSI_CC_PATH=/usr/bin/clang

Quick Verification

Before full runs, verify detected tools by running a small benchmark slice:

pgsi-analyzer benchmark run \
  --algorithms hanoi \
  --methods cpython pypy ctypes cython \
  --runs 2 \
  --benchmarks-dir my-benchmarks \
  --output results_sanity

If one method fails, run per-method first to isolate setup issues.