Skip to content
/ spngt Public

PNG library benchmarking and testing utility

License

Notifications You must be signed in to change notification settings

libspng/spngt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

00b3ebf · May 16, 2023

History

98 Commits
Nov 4, 2022
Oct 31, 2022
Oct 3, 2022
Jan 12, 2023
Oct 28, 2022
Oct 28, 2022
Oct 26, 2022
Sep 29, 2021
May 10, 2021
May 16, 2023
Oct 3, 2022
Oct 18, 2022
Jan 12, 2022
Jan 13, 2022
Jan 14, 2022
Oct 31, 2022
Jun 2, 2022
Jan 14, 2022
Oct 3, 2022
May 10, 2021

Repository files navigation

SPNGT

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.

Dependencies

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

Creating a build

# Add --default-library=static on Windows
meson build --buildtype=release

Running the benchmark

cd build
meson test -t 0 --benchmark --suite decode #or encode
cat meson-logs/benchmarklog.txt

ninja benchmark runs all tests.

Compile with Profile-guided optimization (PGO)

meson configure -Db_pgo=generate
ninja benchmark
meson configure -Db_pgo=use
ninja benchmark
cat meson-logs/benchmarklog.txt

Notes

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.

Command-line interface

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

Running experiments

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