Benchmarks#
fplotlib is compared against Matplotlib. The code lives in benchmarks/ and is run with:
pip install -r benchmarks/requirements.txt
python benchmarks/run_benchmarks.py --repeats 5 --save
Measured items:
Compilation: building fplotlib as a library (
fpm build,-O3).Import vs. compile: Python imports (
matplotlib,numpy) versus compiling the Fortran program to a binary.Runtime: generating a PNG and a PDF from a simple plot (one line) and a complex plot (3 curves, fill, legend, grid, labels, 5000 points), Python script versus Fortran binary.
Animation: a 40-frame, 240-point travelling wave saved as a GIF (
clf/plot/add_frame/save_animationversus MatplotlibFuncAnimationwithPillowWriter).
Results#
Each entry below is one run on one machine; click it to open or close the table. Timings are medians and are only comparable within a single entry. Matplotlib run times exclude imports, which are measured separately (look for the “Import” lines).
To add your machine, run the command above and propose the new
benchmarks/results/*.json file in a pull request. The github-actions entry
is produced by the docs workflow on a GitHub runner at build time.
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz — Linux — 2026-11-07 (2026-11-07-intel-r-core-tm-i7-8565u-cpu-1-80ghz.json)
Machine
| CPU | Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz |
|---|---|
| Clock speed (GHz) | 0.4 |
| OS | Linux |
| Fortran compiler | GNU Fortran (Ubuntu 15.2.0-16ubuntu1) 15.2.0 |
| Fortran flags | -O3 -march=native |
| fpm | Version: 0.13.0, alpha |
| Python | CPython 3.14.4 |
| Matplotlib | 3.11.2 |
| NumPy | 2.3.5 |
Results (median of 5 runs)
| Benchmark | fplotlib (s) | matplotlib (s) |
|---|---|---|
| Compile library | 21.0746 | |
| Compile simple program | 0.1108 | |
| Import simple script | 0.4392 | |
| Run simple -> png | 0.0483 | 0.0747 |
| Run simple -> pdf | 0.0022 | 0.1336 |
| Compile complex program | 0.1119 | |
| Import complex script | 0.4257 | |
| Run complex -> png | 0.0697 | 0.1523 |
| Run complex -> pdf | 0.0560 | 0.2261 |
| Compile animation program | 0.0904 | |
| Import animation script | 0.4327 | |
| Run animation -> gif | 0.9664 | 4.4714 |
Apple M4 Max — macOS — 2026-11-08 (2026-11-08-apple-m4-max.json)
Machine
| CPU | Apple M4 Max |
|---|---|
| OS | macOS |
| Fortran compiler | GNU Fortran (conda-forge gcc 16.1.0-3) 16.1.0 |
| Fortran flags | -O3 -march=native |
| fpm | Version: 0.13.0, alpha |
| Python | CPython 3.9.6 |
| Matplotlib | 3.9.4 |
| NumPy | 2.0.2 |
Results (median of 5 runs)
| Benchmark | fplotlib (s) | matplotlib (s) |
|---|---|---|
| Compile library | 12.4418 | |
| Compile simple program | 0.0744 | |
| Import simple script | 0.1915 | |
| Run simple -> png | 0.0204 | 0.0277 |
| Run simple -> pdf | 0.0025 | 0.0562 |
| Compile complex program | 0.0834 | |
| Import complex script | 0.1911 | |
| Run complex -> png | 0.0302 | 0.0479 |
| Run complex -> pdf | 0.0211 | 0.0872 |
| Compile animation program | 0.0779 | |
| Import animation script | 0.1957 | |
| Run animation -> gif | 0.2778 | 1.1846 |
AMD EPYC 9V74 80-Core Processor — Linux — 2026-11-15 (github-actions.json)
Machine
| CPU | AMD EPYC 9V74 80-Core Processor |
|---|---|
| Clock speed (GHz) | 3.7 |
| OS | Linux |
| Fortran compiler | GNU Fortran (Ubuntu 16-20260322-1ubuntu1) 16.0.1 20260322 (experimental) [trunk r16-8246-g569ace1fa50] |
| Fortran flags | -O3 -march=native |
| fpm | Version: 0.13.0, alpha |
| Python | CPython 3.15.2 |
| Matplotlib | 3.11.2 |
| NumPy | 2.5.4 |
Results (median of 5 runs)
| Benchmark | fplotlib (s) | matplotlib (s) |
|---|---|---|
| Compile library | 22.2341 | |
| Compile simple program | 0.0831 | |
| Import simple script | 0.4172 | |
| Run simple -> png | 0.0491 | 0.0659 |
| Run simple -> pdf | 0.0119 | 0.1272 |
| Compile complex program | 0.0980 | |
| Import complex script | 0.4101 | |
| Run complex -> png | 0.0670 | 0.1291 |
| Run complex -> pdf | 0.0508 | 0.2061 |
| Compile animation program | 0.0829 | |
| Import animation script | 0.4015 | |
| Run animation -> gif | 0.6882 | 3.4494 |