libspng
libspng copied to clipboard
Performance
This issue is for discussing performance in general.
For interlaced images with subimages which match the width of the image there is no deinterlacing to be done, the non-interlaced codepath can be used which involves less copying.
Have you heard of libdeflate? Don’t know how feasible it would be to support here, but should give higher performance (even compared to zlib-ng).
Possibly also of interest, discussion of png performance in wuffs: https://nigeltao.github.io/blog/2021/fastest-safest-png-decoder.html
libdeflate doesn't support streaming, functions like spng_encode_row() wouldn't work, and decompression wouldn't work at all without concatenating the entire IDAT stream into a continuous buffer first, that can be a big memory/performance overhead.
zlib-ng is a better all-around alternative, it supports everything needed for the API and the performance optimizations should be safe to use on untrusted data.