This contains scripts to run a subset of the pyperformance benchmarks quickly.
PYTHON_GIL=0 PYTHONHASHSEED=0 taskset -c 4 ./python fastmark.py
- Disable ALSR to reduce variation:
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space - Use
perf stat -e instructionsto record instructions executed
First build CPython locally. It doesn't need to be installed.
Install the dependencies. If Python is executed from the source directory, then this will install the packages in ~/.local/.
./python -m ensurepip
./python -m pip install -r requirements.txt
- Python compiles
.pycfiles for packages only when they are being installed. If thePYC_MAGIC_NUMBERchanges, then Python will recompile the bytecode while the benchmark is running, potentially distorting results. It will not update the.pycfiles for packages insite-packages, only local__pycache__directories. - Fixing the
PYTHONHASHSEEDreduces variation but may be inapprorpriate for commits that substantially modify dictionary representation.
- connected_components, shortest_path - networkx doesn't work with free threaded Python
- django_template, json, pycparser, pylint, thrift - Pyston benchmarks not yet enabled
- sphinx - benchmark messes with
__builtins__ - python_startup - requires separate process