SPNGT is a benchmarking and testing utility for libspng, libpng, stb_image, lodepng and wuffs.
This is a standalone project, it is also used as a subproject in libspng for benchmarking and to host non-libspng code.
- Meson 0.55.0 or later
- Git LFS for downloading the benchmark images
Meson will fall back to using wraps if the following are not found on the system:
- spng
- libpng
- stb_image
- lodepng
- stb
- zlib
- wuffs
- Lua
# Add --default-library=static on Windows
meson build --buildtype=release
cd build
meson test -t 0 --benchmark --suite decode #or encode
cat meson-logs/benchmarklog.txt
ninja benchmark
runs all tests.
meson configure -Db_pgo=generate
ninja benchmark
meson configure -Db_pgo=use
ninja benchmark
cat meson-logs/benchmarklog.txt
The benchmarks try to exclude system overhead by preloading the PNG into a buffer, this provides better feedback for development, real world performance may not be the same but has been accurate been so far.
Read one file and print the best decode/encode time for each library
$ spngt IMAGE.png
$ spngt IMAGE.png enc # For encode benchmarks
$ spngt info # Print library versions and other information
Or execute a lua script, the rest of the arguments will be exposed through the arg
global
$ spngt main.lua SUITE_NAME FOO.png BAR.png #main.lua takes a base filename (SUITE_NAME) for its output files
Results are written to .csv
files in the build directory, see main.lua.
meson test -t 0 --benchmark tango
meson test -t 0 --benchmark kodak
meson test -t 0 --benchmark mixed