Home

Awesome

hsqoi

Haskell implementatin of the QOI image format.

Benchmarks

The baseline is the reference C code @ e9069e.

Taking a single big .png photo (5616×3744), with either 3 (RGB) or 4 (RGBA) channels and taking a minimum of 5 runs gives, on Core i7 3930k @ 4.0 GHz:

ImplementationDecoding, ms, % of best CEncoding, ms, % of best C
C, gcc 11, -O3 -march=native228117%264102%
C, gcc 11, -O3230118%260100%
C, clang 13, -O3 -march=native211108%356137%
C, clang 13, -O3195100%341131%
Haskell, 3-channel17288%22687%
Haskell, 4-channel18796%20980%

Similarly for a 5120x2880 artwork:

ImplementationDecoding, ms, % of best CEncoding, ms, % of best C
C, gcc 11, -O3 -march=native90130%73102%
C, gcc 11, -O388128%71100%
C, clang 13, -O3 -march=native69100%124175%
C, clang 13, -O370101%124175%
Haskell, 3-channel5579%7099%
Haskell, 4-channel5478%72102%

On Ryzen 3700X, for the photo:

ImplementationDecoding, ms, % of best CEncoding, ms, % of best C
C, gcc 11, -O3 -march=native179121%198101%
C, gcc 11, -O3174118%196100%
C, clang 13, -O3 -march=native158107%266136%
C, clang 13, -O3148100%252129%
Haskell, 3-channel13289%19197%
Haskell, 4-channel14598%14172%

For the artwork:

ImplementationDecoding, ms, % of best CEncoding, ms, % of best C
C, gcc 11, -O3 -march=native68117%56102%
C, gcc 11, -O366114%55100%
C, clang 13, -O3 -march=native60103%96175%
C, clang 13, -O358100%90164%
Haskell, 3-channel4883%5498%
Haskell, 4-channel4883%5295%