PngOptimizer 2.3

Because the free lunch is over, buying a new cpu is not enough anymore to increase the performances of your software. Computing now offers cheap parallel processing, but it also means software has to be adapted.

This is the main change of PngOptimizer 2.3. The optimization engine is now multithreaded, with up to four jobs running in parallel. This gives a boost in optimization speed up to 50%. The optimization is balanced among several cores of the CPU, as shown in that example:

four cores

The changelog:

  • new: multithreaded optimization for faster processing on multicore CPUs
  • new: better optimization in some cases of greyscale images
  • misc: updated ZLib 1.2.5 to 1.2.7 (compression library)

As this is the first version of PngOptimizer to use multithreading for optimization (multithreading was already used to separate GUI and optimization), I think there is still room for improvements.

For example, I let the system automatically balance the load, but maybe I could give it some hints to speed-up balancing? I also noticed that, unfortunately, some time is wasted in context switching and synchronization when optimizing several small images, so I will probably have to set a threshold to switch between monothreaded and multithreaded.

For future releases, I started concentrating on the Deflate compression itself, used by the PNG format. Actually, the PNG uses the ZLib compression format, but ZLib compression is just Deflate compression with a small header and trailer.

I have seen software able to output ZLib compatible streams with a better compression ratio than the ZLib library itself. I wrote some experimental code that is able to decode quite fast a ZLib stream, faster than the ZLib actually. However, the compression part is still slow and the result is only better than the ZLib of a few bytes. Hopefully I will have a code base good enough to be used for next PngOptimizer releases.

Note: I switched to english for my posts after requests from non-french speakers interested in those detailed changelogs.