This repository contains benchmarking scripts and result logs for evaluating the performance of pure Python versus parallel implementations using either multiprocessing or Python subinterpreters (referred to as "subint"). The benchmarks include both CPU-bound tasks (e.g. SHA-256 hashing) and I/O-bound tasks (e.g. sleeping), and are designed to assess scalability, latency, and throughput across different parallelization strategies.
Contains the pure python implementation:
purepython_hash.py: Performs repeated SHA-256 hashing.purepython_sleep.py: Runs sleep-based workloads to simulate I/O-bound delay.results/: Stores CSV files with benchmark results:results_purepy_hash.csvresults_purepy_sleep.csv
Contains parallel benchmarks using two concurrency models:
*_proc.pyscripts use multiprocessing (separate OS processes).*_subint.pyscripts use subinterpreters (isolated Python interpreters in the same process).farm-latency.py: Main benchmark runner that executes tasks using multiple cores and logs latency and performance.latency_log.csv: Aggregated latency results fromfarm-latency.py.
The results/ subdirectory includes:
latency/: Contains detailed per-core latency logs, organized by method:hash_proc/: Latency logs for multiprocessing runs.hash_subint/: Latency logs for subinterpreter runs.- Each file represents a benchmark using a specific number of cores (e.g.
latency_log_ash_subint_8.csvfor 8-core subinterpreter run).
This benchmark suite evaluates:
-
Python Parallel Execution:
- Pure Python concurrency.
-
FastFlow-Python Parallel Execution:
- Using multiprocessing (
*_proc.py) - Using subinterpreters (
*_subint.py)
- Using multiprocessing (
Each strategy is tested on both CPU-bound and I/O-bound workloads, with multiple core counts to observe scalability and overhead.
Metrics collected:
- Total execution time
- Latency per task/core
- Python 3.9+ (for subinterpreter support via the
interpretersmodule) - FastFlow-Python
# Run pure Python benchmarks
python src/purepythonbench/purepython_hash.py
python src/purepythonbench/purepython_sleep.py
# Run multiprocessing benchmarks
python src/pyFF-bench/hash_proc.py
python src/pyFF-bench/sleep_proc.py
# Run subinterpreter benchmarks
python src/pyFF-bench/hash_subint.py
python src/pyFF-bench/sleep_subint.py
# Run full latency experiment
python src/pyFF-bench/farm-latency.py