etemesi254/zune-image

QOI encoding/decoding performance

Opened this issue · 2 comments

QOI is my go-to image format for a high performance PNG replacement. However it seems the QOI codec in zune-image is rather slow (comparing to PNG, or even JPEG). Here is my benchmark result:

Result on i9-9900K (3.60 GHz) + 64GB RAM

zune encode qoi         time:   [5.9150 ms 6.0006 ms 6.0984 ms]
image-rs encode qoi     time:   [3.9894 ms 4.0335 ms 4.0826 ms]
zune encode jpeg        time:   [3.3753 ms 3.3994 ms 3.4257 ms]
zune encode png         time:   [2.7774 ms 2.8188 ms 2.8650 ms]

zune decode qoi         time:   [2.0401 ms 2.0505 ms 2.0617 ms]
image-rs decode qoi     time:   [1.5920 ms 1.5990 ms 1.6066 ms]
zune decode jpeg        time:   [942.27 µs 948.51 µs 955.29 µs]
zune decode png         time:   [853.24 µs 869.38 µs 886.10 µs]

The benchmark repo is here: https://github.com/hillin/zune-image-decode-benchmark

edit: added image-rs QOI codec benchmark for reference.

I am aware of this, and the benchmarks too reflect that. It's mainly a combination of me making zune-{format} rely on a single api for writing and reading which means some functions won't be extremely optimized e.g when I could have just used a vec and the amount of time i have to spend micro optimizing stuff isn't infinite, I have to compromise somewhere.

But i will look into making it faster, or if you have time I welcome any pr

I've been looking at qoi-rust and their performance seems very promising:

zune encode qoi         time:   [5.0764 ms 5.1160 ms 5.1592 ms]
image-rs encode qoi     time:   [3.1565 ms 3.1924 ms 3.2295 ms]
qoi-rust encode qoi     time:   [1.5007 ms 1.5074 ms 1.5148 ms]

zune decode qoi         time:   [1.9367 ms 1.9449 ms 1.9538 ms]
image-rs decode qoi     time:   [1.3363 ms 1.3421 ms 1.3480 ms]
qoi-rust decode qoi     time:   [1.0419 ms 1.0474 ms 1.0537 ms]

Integrating them might not be a bad idea!