Be able to test and bench the libspng library

That's libspng with an 's', instead of libpng without an 's'.

Wuffs' std/png and std/zlib implementations have not been fully
optimized yet, but as a snapshot, here's how it compares with these
"mimic" libraries, libspng and libpng.

On a mid-range x86_64 laptop:

Wuffs/clang9:
wuffs_png_decode_image_19k_8bpp/clang9                    91.9MB/s ± 0%
wuffs_png_decode_image_40k_24bpp/clang9                    128MB/s ± 0%
wuffs_png_decode_image_77k_8bpp/clang9                     342MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   324MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   258MB/s ± 0%
wuffs_png_decode_image_4002k_24bpp/clang9                  127MB/s ± 0%

Wuffs/gcc10:
wuffs_png_decode_image_19k_8bpp/gcc10                     94.3MB/s ± 0%
wuffs_png_decode_image_40k_24bpp/gcc10                     131MB/s ± 0%
wuffs_png_decode_image_77k_8bpp/gcc10                      348MB/s ± 1%
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    319MB/s ± 0%
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    269MB/s ± 0%
wuffs_png_decode_image_4002k_24bpp/gcc10                   131MB/s ± 0%

libspng/clang9:
mimic_png_decode_image_19k_8bpp/clang9                    59.3MB/s ± 1%
mimic_png_decode_image_40k_24bpp/clang9                   78.4MB/s ± 0%
mimic_png_decode_image_77k_8bpp/clang9                     189MB/s ± 0%
mimic_png_decode_image_552k_32bpp_ignore_checksum/clang9   235MB/s ± 0%
mimic_png_decode_image_552k_32bpp_verify_checksum/clang9   203MB/s ± 0%
mimic_png_decode_image_4002k_24bpp/clang9                  110MB/s ± 0%

libspng/gcc10:
mimic_png_decode_image_19k_8bpp/gcc10                     59.5MB/s ± 0%
mimic_png_decode_image_40k_24bpp/gcc10                    77.6MB/s ± 0%
mimic_png_decode_image_77k_8bpp/gcc10                      188MB/s ± 0%
mimic_png_decode_image_552k_32bpp_ignore_checksum/gcc10    223MB/s ± 0%
mimic_png_decode_image_552k_32bpp_verify_checksum/gcc10    193MB/s ± 0%
mimic_png_decode_image_4002k_24bpp/gcc10                   109MB/s ± 0%

libpng (Debian_Testing_Bullseye /usr/lib/x86_64-linux-gnu/libpng.so):
mimic_png_decode_image_19k_8bpp                           58.3MB/s ± 0%
mimic_png_decode_image_40k_24bpp                          73.1MB/s ± 0%
mimic_png_decode_image_77k_8bpp                            177MB/s ± 0%
mimic_png_decode_image_552k_32bpp_ignore_checksum               skipped
mimic_png_decode_image_552k_32bpp_verify_checksum          146MB/s ± 0%
mimic_png_decode_image_4002k_24bpp                         104MB/s ± 0%
This commit is contained in:
Nigel Tao committed 2021-01-22 13:15:42 +11:00
1 parent 170a810486
commit fd8025342e
2 files changed
+119 -3

No files matched your search

+9 -3
View File
@@ -37,7 +37,11 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
"wuffs mimic cflags" to run the mimic benchmarks.
*/
// !! wuffs mimic cflags: -DWUFFS_MIMIC -lpng
// Libpng requires -lpng (and nothing else). Libspng (note the 's') requires
// -lm and -lz (and nothing else). It's easiest to just link with the union of
// all of these libraries.
//
// !! wuffs mimic cflags: -DWUFFS_MIMIC -lm -lpng -lz
// Wuffs ships as a "single file C library" or "header file library" as per
// https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
@@ -104,12 +108,14 @@ do_test_xxxxx_png_decode_bad_crc32_checksum_critical(
"@001F=8A=00;test/data/hippopotamus.regular.png",
// Change a byte in a PLTE CRC-32 checksum.
"@0372=52=00;test/data/bricks-dither.png",
// Change a byte in a non-final IDAT CRC-32 checksum.
"@2029=B7=00;test/data/bricks-color.png",
#ifndef WUFFS_MIMICLIB_PNG_DOES_NOT_VERIFY_FINAL_IDAT_CHECKSUMS
// Change a byte in a final IDAT Adler-32 checksum.
"@084E=26=00;test/data/hippopotamus.regular.png",
// Change a byte in a final IDAT CRC-32 checksum.
"@084F=F4=00;test/data/hippopotamus.regular.png",
// Change a byte in a non-final IDAT CRC-32 checksum.
"@2029=B7=00;test/data/bricks-color.png",
#endif
};
int tc;