Well done! The concept to process only default zLib streams on maximum compression level first seems a bit odd, but of course it makes very fast encoding possible.
Some general comments:
- Adding a version number to the command line output would be useful
- Allow shortcuts "e"/"d" for "encode"/"decode", too
- Duration output in ms is useful for comparisons, but "human readable" output in hours/minutes/seconds is often preferred
- Open source would be better
pzlib didn't detect any streams in FlashMX.pdf and silesia.zip, so I tested one of my other standard test files, an Ubuntu 15.10 image:
So encoding without "-v" (verification) is very fast, but decoding fails. Encoding with "-v" is better (decoding is successful), but slower.
Original: 1,178,386,432 bytes
-cn -intense -d0 (encode): 19 min 30 s, 2,982,177,562 bytes
-r (decode): 10 min 47 s
-cn -intense -d0 -zl96,97,98,99 (encode): 14 min 43 s, 2,981,716,646 bytes
encode: 2 min 36 s, 2,974,882,594 bytes
decode: 10 min 58 s, not identical, output is longer (1,178,403,868 bytes) and differs (first different byte at offset 0x0D05BCDC)
decode to stdout: 10 min 45 s
encode -v: 17 min 29 s, 2,972,136,388 bytes
decode -t1 stdin, stdout: 16 min 9 s
decode -t2 stdin, stdout: 12 min 13 s
decode -t4 stdin, stdout: 9 min 39 s, identical
Multithreading works, but the baseline is quite slow, so decoding with the max. number of threads is only a bit faster than Precomp.