# szmosi/python-speed-lab architecture

> Architecture diagram of the GitHub repository szmosi/python-speed-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/szmosi/python-speed-lab
- Repository: https://github.com/szmosi/python-speed-lab

## Overview

Python Speed Lab runs three benchmark categories—sum of squares, matrix multiplication, and Mandelbrot—across Python and accelerated implementations, records elapsed times, then displays and visualizes results. The sampled source shows the suite dispatching work and storing timings; the README also identifies CPU/GPU comparison and visualization as product goals. The Cython implementation is present in the tree but not sampled, so its internal behavior is not inferred.

Main entry points: [`benchmark_all.py`](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py) (Mandel benchmark), [`fast_code.pyx`](https://github.com/szmosi/python-speed-lab/blob/main/fast_code.pyx) (Cython methods)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Benchmark execution"]
  node_suite["Benchmark suite<br/>[benchmark_all.py]"]
  node_sum["Sum benchmark<br/>[benchmark_all.py]"]
  node_matmul["Matrix benchmark<br/>[benchmark_all.py]"]
  node_mandel["Mandel benchmark<br/>[benchmark_all.py]"]
end

subgraph group_methods["Compute methods"]
  node_py["Python methods<br/>[benchmark_all.py]"]
  node_multiprocess["Multiprocess methods<br/>[benchmark_all.py]"]
  node_numpy["NumPy methods<br/>[benchmark_all.py]"]
  node_numba["Numba methods<br/>[benchmark_all.py]"]
  node_cython["Cython methods<br/>[fast_code.pyx]"]
  node_gpu["GPU methods<br/>[benchmark_all.py]"]
end

subgraph group_results["Results and visualization"]
  node_timings["Timing results<br/>[benchmark_all.py]"]
  node_display["Result display<br/>[benchmark_all.py]"]
  node_visualization["Plots and animation<br/>[benchmark_all.py]"]
end

node_user(("Engineer"))
node_cuda["CUDA runtime"]

node_user -->|"runs"| node_suite
node_suite -->|"runs"| node_sum
node_suite -->|"runs"| node_matmul
node_suite -->|"runs"| node_mandel
node_sum -->|"benchmarks"| node_py
node_sum -->|"benchmarks"| node_multiprocess
node_sum -->|"benchmarks"| node_numpy
node_sum -->|"benchmarks"| node_numba
node_matmul -->|"benchmarks"| node_py
node_matmul -->|"benchmarks"| node_multiprocess
node_matmul -->|"benchmarks"| node_numpy
node_matmul -->|"benchmarks"| node_numba
node_matmul -->|"benchmarks"| node_gpu
node_mandel -->|"benchmarks"| node_py
node_mandel -->|"benchmarks"| node_multiprocess
node_mandel -->|"benchmarks"| node_numpy
node_mandel -->|"benchmarks"| node_numba
node_mandel -->|"calls"| node_cython
node_mandel -->|"benchmarks"| node_gpu
node_gpu -->|"uses"| node_cuda
node_sum -->|"records"| node_timings
node_matmul -->|"records"| node_timings
node_mandel -->|"records"| node_timings
node_suite -->|"displays"| node_display
node_suite -->|"plots"| node_visualization

click node_suite "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_sum "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_matmul "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_mandel "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_py "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_multiprocess "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_numpy "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_numba "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_cython "https://github.com/szmosi/python-speed-lab/blob/main/fast_code.pyx"
click node_gpu "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_timings "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_display "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"
click node_visualization "https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_suite,node_sum,node_matmul,node_mandel toneBlue
class node_py,node_multiprocess,node_numpy,node_numba,node_cython,node_gpu toneAmber
class node_timings,node_display,node_visualization toneMint
class node_user,node_cuda toneIndigo
```

## Components

### Benchmark execution

- [Benchmark suite](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [Sum benchmark](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [Matrix benchmark](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [Mandel benchmark](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`

### Compute methods

- [Python methods](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [Multiprocess methods](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [NumPy methods](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [Numba methods](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [Cython methods](https://github.com/szmosi/python-speed-lab/blob/main/fast_code.pyx): `fast_code.pyx`
- [GPU methods](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`

### Results and visualization

- [Timing results](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [Result display](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`
- [Plots and animation](https://github.com/szmosi/python-speed-lab/blob/main/benchmark_all.py): `benchmark_all.py`

### Other components

- **Engineer**
- **CUDA runtime**

## Connections

- Engineer → Benchmark suite: runs (evidence: `benchmark_all.py`)
- Benchmark suite → Sum benchmark: runs (evidence: `benchmark_all.py`)
- Benchmark suite → Matrix benchmark: runs (evidence: `benchmark_all.py`)
- Benchmark suite → Mandel benchmark: runs (evidence: `benchmark_all.py`)
- Sum benchmark → Python methods: benchmarks (evidence: `benchmark_all.py`)
- Sum benchmark → Multiprocess methods: benchmarks (evidence: `benchmark_all.py`)
- Sum benchmark → NumPy methods: benchmarks (evidence: `benchmark_all.py`)
- Sum benchmark → Numba methods: benchmarks (evidence: `benchmark_all.py`)
- Matrix benchmark → Python methods: benchmarks (evidence: `benchmark_all.py`)
- Matrix benchmark → Multiprocess methods: benchmarks (evidence: `benchmark_all.py`)
- Matrix benchmark → NumPy methods: benchmarks (evidence: `benchmark_all.py`)
- Matrix benchmark → Numba methods: benchmarks (evidence: `benchmark_all.py`)
- Matrix benchmark → GPU methods: benchmarks (evidence: `benchmark_all.py`)
- Mandel benchmark → Python methods: benchmarks (evidence: `benchmark_all.py`)
- Mandel benchmark → Multiprocess methods: benchmarks (evidence: `benchmark_all.py`)
- Mandel benchmark → NumPy methods: benchmarks (evidence: `benchmark_all.py`)
- Mandel benchmark → Numba methods: benchmarks (evidence: `benchmark_all.py`)
- Mandel benchmark → Cython methods: calls (evidence: `benchmark_all.py`)
- Mandel benchmark → GPU methods: benchmarks (evidence: `benchmark_all.py`)
- GPU methods → CUDA runtime: uses (evidence: `benchmark_all.py`)
- Sum benchmark → Timing results: records (evidence: `benchmark_all.py`)
- Matrix benchmark → Timing results: records (evidence: `benchmark_all.py`)
- Mandel benchmark → Timing results: records (evidence: `benchmark_all.py`)
- Benchmark suite → Result display: displays (evidence: `benchmark_all.py`)
- Benchmark suite → Plots and animation: plots (evidence: `benchmark_all.py`)
