tl;dr reading the same images in webp is twice as slow as in png, why ?
Dear WebP community,
I currently have a speed critical piece of code that I am trying to optimize.
The pixels processing side is now fast enough to make the disk I/O the core bottleneck.
I have just implemented a test where I replace my image reading module from png images, to reading a sequence of webp images.
The ~1000 png images take 350 Mb of disk, while the equivalent webp images take only 214 Mb.
I used "cwebp -preset photo -lossless", because I should not have compression artifacts in my input images, and the images are photos.
Having less bits to read from disk and faster decoding, I expected to see a gain in speed overall.
My current results are: reading the same images is twice as slow using webp rather than png.
I have validated this on two different machines (a work station and a high end laptop with SSD), obtaining the similar results.
Both versions are single core, sequential "read and decode".
I have tried to inspect if my PNG code (based on boost gil io extension) is reading the disk in a "smart way", however it seems to pass the file descriptor directly to libpng.
On the webp side I have implemented the file reading using ifstream, fread, and mmap, without obtaining a significant difference overall.
I am using the precompiled library binaries from the webp website (linux, 64 bits) to be comparable with the .deb packages for libpng (recompiling webp with -O3 and -arch=native would give an unfair advantage).
Does anyone have an idea of what is going on ?
Should I convert the png files in a special way to webp to still enjoy the speed gain ?
Thank you very much for your comments and suggestions.
Regards,
rodrigob.