libspng icon indicating copy to clipboard operation
libspng copied to clipboard

Performance

Open randy408 opened this issue 6 years ago • 3 comments

This issue is for discussing performance in general.

randy408 avatar Oct 21 '19 20:10 randy408

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.

randy408 avatar Nov 06 '19 09:11 randy408

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

andrews05 avatar Sep 11 '22 01:09 andrews05

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.

randy408 avatar Sep 11 '22 13:09 randy408