From 81616da67154867527960756fced24814e50df48 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt <2812720+tleonhardt@users.noreply.github.com> Date: Sat, 5 Dec 2026 19:59:49 -0500 Subject: [PATCH 1/2] Show README benchmark speedups to one decimal place --- README.md | 16 ++++++++-------- comparison/benchmark.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f594dcf..1e474f4 100644 --- a/README.md +++ b/README.md @@ -37,14 +37,14 @@ samples of one million calls. Speedup is relative to pure Python on the same mac | Implementation | Median ns/call | Speedup vs. Python | | ---------------- | -------------: | -----------------: | -| Python | 219.0 | 1.00× | -| CFFI (ABI) | 107.5 | 2.04× | -| Cython (wrapper) | 21.4 | 10.21× | -| Cython (typed) | 21.2 | 10.35× | -| SWIG | 30.6 | 7.17× | -| pybind11 | 39.4 | 5.56× | -| nanobind | 23.6 | 9.28× | -| PyO3 | 25.9 | 8.44× | +| Python | 219.0 | 1.0× | +| CFFI (ABI) | 107.5 | 2.0× | +| Cython (wrapper) | 21.4 | 10.2× | +| Cython (typed) | 21.2 | 10.4× | +| SWIG | 30.6 | 7.2× | +| pybind11 | 39.4 | 5.6× | +| nanobind | 23.6 | 9.3× | +| PyO3 | 25.9 | 8.4× | To generate this table on your machine, run the following from the repository root after setup. See the [benchmark guide](docs/benchmark.md) for how the calls are timed and how to change the workload. diff --git a/comparison/benchmark.py b/comparison/benchmark.py index d0d9b54..b1a652a 100644 --- a/comparison/benchmark.py +++ b/comparison/benchmark.py @@ -33,7 +33,7 @@ def main() -> None: print() print("| Implementation | Median ns/call | Speedup vs. Python |") print("| --- | ---: | ---: |") - row = "| {name} | {ns:.1f} | {speedup:.2f}× |" + row = "| {name} | {ns:.1f} | {speedup:.1f}× |" else: print(f"{'Implementation':<18} {'ns/call':>10} {'speedup':>9}") row = "{name:<18} {ns:>10.1f} {speedup:>8.2f}x" From 3fe460ada70d7810c2c459b0b9ae7562091bf5c6 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt <2812720+tleonhardt@users.noreply.github.com> Date: Sat, 5 Dec 2026 20:00:30 -0500 Subject: [PATCH 2/2] Link README guides to the published documentation --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1e474f4..48f77b6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ Call the same Fibonacci function from Python through [CFFI](https://cffi.readthe Install [uv](https://docs.astral.sh/uv/getting-started/installation/), a C/C++17 compiler, Rust with Cargo, and the zlib development headers. The default interpreter is CPython 3.15. Platform-specific -instructions are in the [getting-started guide](docs/index.md). +instructions are in the +[getting-started guide](https://tleonhardt.github.io/Python_Interface_Cpp/#install-the-toolchain). ```sh uv sync --locked @@ -47,7 +48,8 @@ samples of one million calls. Speedup is relative to pure Python on the same mac | PyO3 | 25.9 | 8.4× | To generate this table on your machine, run the following from the repository root after setup. See -the [benchmark guide](docs/benchmark.md) for how the calls are timed and how to change the workload. +the [benchmark guide](https://tleonhardt.github.io/Python_Interface_Cpp/benchmark/) for how the +calls are timed and how to change the workload. ```sh uv run --locked python -m comparison.benchmark --markdown -n 20 --calls 1000000 --repeat 9 @@ -59,9 +61,10 @@ uv run --locked python -m comparison.benchmark --markdown -n 20 --calls 1000000 declarations and the native functions they call. - [Rust extension](rust/) uses PyO3 and maturin. It exposes the same Python function as the C and C++ examples. -- [The guide to the bindings](docs/bindings.md) explains when each approach fits. - [Workshop exercises](docs/exercises.md) cover typed loops, buffers, vectors, callbacks, and - passing Python sequences to Rust with PyO3. +- [The guide to the bindings](https://tleonhardt.github.io/Python_Interface_Cpp/bindings/) explains + when each approach fits. + [Workshop exercises](https://tleonhardt.github.io/Python_Interface_Cpp/exercises/) cover typed + loops, buffers, vectors, callbacks, and passing Python sequences to Rust with PyO3. The original [slides](Interfacing_C_C++_with_Python.pdf) and [lab handout](Interfacing_C_C++_with_Python-Exercises.pdf) accompany the