No description
  • Python 62%
  • JavaScript 12.2%
  • C++ 7.5%
  • TypeScript 5.9%
  • Rust 5%
  • Other 7.4%
Find a file
2026-11-02 12:53:09 -05:00
src/py_perf Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
.gitignore initial work 2026-11-02 09:44:41 -05:00
.python-version Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
graph-20261102_113241.png Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
INVESTIGATION.md initial work 2026-11-02 09:44:41 -05:00
Makefile Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
package-lock.json initial work 2026-11-02 09:44:41 -05:00
package.json initial work 2026-11-02 09:44:41 -05:00
perf_cpp.cpp Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
perf_go.go Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
perf_js.js Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
perf_python_312.py Use Python 3.12 for baseline benchmark 2026-11-02 12:53:09 -05:00
perf_python_315.py Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
perf_rust.rs Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
perf_rust_release initial work 2026-11-02 09:44:41 -05:00
perf_tmp.py initial work 2026-11-02 09:44:41 -05:00
perf_ts.js initial work 2026-11-02 09:44:41 -05:00
perf_ts.ts initial work 2026-11-02 09:44:41 -05:00
pyproject.toml Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
README.md Use Python 3.12 for baseline benchmark 2026-11-02 12:53:09 -05:00
results-20261102_113241.md Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00
run_tests.py Use Python 3.12 for baseline benchmark 2026-11-02 12:53:09 -05:00
tsconfig.json initial work 2026-11-02 09:44:41 -05:00
uv.lock Refactor test harness to use .venv for matplotlib and support multiple thread counts 2026-11-02 12:14:16 -05:00

Performance Testing Suite

This suite compares implementations of sum((i * i) % 97) over i in [0, 10,000,000). Each benchmark runs four jobs; the runner tests configurations of 1, 4, and 8 threads, three times each, and averages the elapsed times.

Setup

Install Go, Rust (rustc), clang++, Node.js, and Python 3.12. The runner expects Python 3.12 at /opt/homebrew/opt/python@3.12/bin/python3.12; change python312 in run_tests.py if it is installed elsewhere.

Create the project virtual environment with Python 3.15 or newer and install the dependencies (including matplotlib for the graph):

uv sync

The runner uses .venv/bin/python for the Python 3.15 benchmark. It labels that benchmark free-threaded, but the interpreter must actually be a free-threaded build for that comparison to be valid. The benchmark prints whether the GIL is enabled when run directly.

Make commands

Command Effect
make or make all Build the Go, Rust, and C++ binaries.
make build Build all three binaries in /tmp.
make build-go Build /tmp/perf_go_bin.
make build-rust Build /tmp/perf_rust with optimization and LTO.
make build-cpp Build /tmp/perf_cpp with -O2 and pthreads.
make run Build all three binaries, then run .venv/bin/python run_tests.py to benchmark and generate a report.
make clean Remove the three /tmp binaries and results-*.md and graph-*.png in the current directory.

make run also rebuilds the binaries as perf_go_bin, perf_rust, and perf_cpp in the project directory; make clean does not remove those copies. The runner writes a timestamped results-YYYYMMDD_HHMMSS.md report and, when matplotlib is available, a corresponding graph-YYYYMMDD_HHMMSS.png in the project directory.

The runner benchmarks Go, Rust, C++, JavaScript (perf_js.js), Python 3.12, and the virtual environment's Python. TypeScript (perf_ts.ts and perf_ts.js) and perf_tmp.py are not part of make run. Individual benchmark programs accept NUM_THREADS (default 4), for example:

NUM_THREADS=1 .venv/bin/python perf_python_315.py

The runner uses program-reported elapsed time when available and otherwise falls back to subprocess wall time. It does not check benchmark subprocess exit codes, so inspect the environment and output if results look suspicious.