Method
How a number on these pages is computed, and how to get the same numbers on your own machine.
Each corpus entry is one image (a genre, a size and a format). For a library , is the best of 7 timed runs of one operation on entry , is the size in bytes of the file it wrote, and is its extra peak memory. Two libraries are compared only on the entries where both ran.
- Reference library. is the number of entries on which was fastest, and is the library that won the most. The count shows up in the per-operation summaries.
- Headline ratio. Over the entries both libraries ran, . It is the mean of each entry's own ratio (ratio first, then average), so a 64x64 image counts as much as a 4000x4000 one. Above 1 means took longer than the reference. Output size and extra memory use the same formula with and in place of .
- Trend charts. For an image of pixels, let be the synthetic entries of that size (photo, gradient, noise, graphics). Each library's point is for time, throughput in MP/s, and for memory. Real photographs each have an odd size of their own, so they are left out of these charts (they still count in every ratio above).
- Reading a ratio. Averaging ratios is not symmetric: a library 10 times faster on one entry and 10 times slower on another scores , not 1. Read it together with the win count .
Reproduce
From the repository root:
cmake -S benchmarks -B benchmarks/build
cmake --build benchmarks/build --target stb_benchmark
stb_benchmark builds the corpus, checks every output (nothing is timed before every library's result has passed), measures speed and memory, and writes benchmarks/outputs/. Each step is also its own target (cmake --build benchmarks/build --target <name>); benchmarks/README.md lists them, and explains how the corpus was built, why timing is best-of-N, and the memory-measurement problem the suite works around.
The site draws what is committed in benchmarks/outputs/, so after a new run commit that folder and build the site again (python3 scripts/prepare.py bench copies it).