Sat 16 Jan 2010 07:52:37 PM UTC, comment #1:
I've done some preliminary testing on a limited set of maps, doing the following:
Listed times are on a 5337x3316 pixels, 3x8 bits/pixel map of Haarlem. Recorded on a Phenom II quad core @ 3.2Ghz with 8Gb RAM. Keep in mind that optipng doesn't use multithreading and uses only a single core.
OptiPNG 0.6.2.1: Advanced PNG optimizer. (version that comes with Ubuntu Karmic).
# exhaustive search
time optipng -zc1-9 -zm1-9 -zs0-3 -f0-5 <png>
15 minutes, 23 seconds (real)
# 240 trials - too long to run on the server
time optipng -o7 <png>
4 minutes, 5 seconds (real)
# 16 trials - doable
time optipng -o3 <png>
39 seconds (real)
# about 8 or so trials - much better
time optipng -zm 9 -zc 9 <png>
22 seconds (real)
-o7 came up with a setting that reduced the size the most:
Selecting parameters:
zc = 9 zm = 9 zs = 0 f = 0 IDAT size = 2485922
Output file size = 2485997 bytes (429704 bytes = 14.74% decrease)
I noticed that -o3 covers this range as well, and so does the explicit selection of -zm 9 and -zc 9. They just do so much more quickly.
Conclusions at this point:
- optipng -o3 is a good tradeoff between time to run and size reduction, particularly because it also found the best parameters.
Todo:
- Create a harness to create two dozen maps of various parts in the world and their indexes;
- Have the harness time optipng at exhaustive, -o7, -o3, and zc/zm and use -log;
- See if the best parameters selected by the exhaustive search for each of the 24 maps are covered by the other, faster searches as well;
- Select the parameters with the best size/time tradeoff;
- Run the entire test set 3 times to have more accurate timing
- Build a system optimised binary and see if it runs significantly faster than the stock Karmic supplied .deb
- Allow maposmaticd to call optipng with the parameters we find and decide on (read from the configuration file)
- If it turns out maps compress better with 'x' and indexes better with 'y' and this has no time tradeoff, add a configuration value for both separately.
|