Benchmarks
libstb is measured against Pillow, OpenCV, imageio and scikit-image, one operation at a time: decoding, encoding, resizing, editing, drawing text and installing. Every chart in this chapter is drawn from one file, benchmarks/outputs/benchmark.json, which the benchmark suite writes; nothing here is typed by hand.
At a glance
Mean time of each library as a multiple of the reference, the library that was fastest on the most corpus entries (the reference column). 1.00× is the reference itself, and below 1 means less time than the reference. How the mean is taken, and why a mean of ratios needs care, is on the method page.
| Operation | Reference | libstb | libstb (sRGB-correct) | Pillow | OpenCV | imageio |
|---|---|---|---|---|---|---|
| Decode | libstb | 1.00× | – | 2.04× | 0.90× | 3.34× |
| Encode PNG | libstb | 1.00× | – | 2.07× | 1.69× | 2.27× |
| Encode JPEG | OpenCV | 1.00× | – | 0.54× | 0.45× | 0.94× |
| Resize, half size, cubic | OpenCV | 1.00× | 1.97× | 4.37× | 0.55× | – |
| RGB to gray | OpenCV | 1.00× | – | 1.43× | 0.83× | – |
Where these numbers came from
Before anything was timed, every operation and library was run on small non-square images and its output checked (exact pixels for lossless formats, close for JPEG and resizing): 225 checks passed, 0 failed, 11 library/operation pairs unavailable (formats a library cannot handle at all).
| CPU | Intel(R) Xeon(R) Processor |
| Logical cores | 1 |
| RAM | 3.9 GiB |
| Architecture | x86_64 |
| OS | Linux 6.18.44-fc-v114 |
| Python | CPython 3.12.3 |