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_animation versus Matplotlib FuncAnimation with PillowWriter).

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

CPUIntel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Clock speed (GHz)0.4
OSLinux
Fortran compilerGNU Fortran (Ubuntu 15.2.0-16ubuntu1) 15.2.0
Fortran flags-O3 -march=native
fpmVersion: 0.13.0, alpha
PythonCPython 3.14.4
Matplotlib3.11.2
NumPy2.3.5

Results (median of 5 runs)

Benchmarkfplotlib (s)matplotlib (s)
Compile library21.0746
Compile simple program0.1108
Import simple script0.4392
Run simple -> png0.04830.0747
Run simple -> pdf0.00220.1336
Compile complex program0.1119
Import complex script0.4257
Run complex -> png0.06970.1523
Run complex -> pdf0.05600.2261
Compile animation program0.0904
Import animation script0.4327
Run animation -> gif0.96644.4714
Apple M4 Max — macOS — 2026-11-08 (2026-11-08-apple-m4-max.json)

Machine

CPUApple M4 Max
OSmacOS
Fortran compilerGNU Fortran (conda-forge gcc 16.1.0-3) 16.1.0
Fortran flags-O3 -march=native
fpmVersion: 0.13.0, alpha
PythonCPython 3.9.6
Matplotlib3.9.4
NumPy2.0.2

Results (median of 5 runs)

Benchmarkfplotlib (s)matplotlib (s)
Compile library12.4418
Compile simple program0.0744
Import simple script0.1915
Run simple -> png0.02040.0277
Run simple -> pdf0.00250.0562
Compile complex program0.0834
Import complex script0.1911
Run complex -> png0.03020.0479
Run complex -> pdf0.02110.0872
Compile animation program0.0779
Import animation script0.1957
Run animation -> gif0.27781.1846
AMD EPYC 9V74 80-Core Processor — Linux — 2026-11-15 (github-actions.json)

Machine

CPUAMD EPYC 9V74 80-Core Processor
Clock speed (GHz)3.7
OSLinux
Fortran compilerGNU Fortran (Ubuntu 16-20260322-1ubuntu1) 16.0.1 20260322 (experimental) [trunk r16-8246-g569ace1fa50]
Fortran flags-O3 -march=native
fpmVersion: 0.13.0, alpha
PythonCPython 3.15.2
Matplotlib3.11.2
NumPy2.5.4

Results (median of 5 runs)

Benchmarkfplotlib (s)matplotlib (s)
Compile library22.2341
Compile simple program0.0831
Import simple script0.4172
Run simple -> png0.04910.0659
Run simple -> pdf0.01190.1272
Compile complex program0.0980
Import complex script0.4101
Run complex -> png0.06700.1291
Run complex -> pdf0.05080.2061
Compile animation program0.0829
Import animation script0.4015
Run animation -> gif0.68823.4494