Make PNJ the default map image io backend
Configs with (effectively) default image io settings will be switched to use PNJ. Otherwise, they will continue to use BufferedImage. Acceptable values for the backend option are pnj and bufferedimage.
Some basic testing shows that PNJ gives compression near the max setting for BufferedImage while taking less time.
The following results are for rendering the same map twice in a row (after a warmup run) averaged over a couple of runs (time), and for the whole tiles directory for the dimension (size). Time is what was spent in MapImage#save on the image io thread as measured by spark (async profiler).
| Description | Size | Time |
|---|---|---|
| PNJ | 724K | 1400ms |
| BufferedImage compress-images=enabled, value=1 | 712K | 2300ms |
| BufferedImage compress-images=disabled | 804K | 950ms |
Questions to answer before merging:
- Do we want to change the default or just add an option?
- Typically when users are bottlenecked by image io it's due to disk speed, not encoding/decoding.
- We may want to run more benchmarks separating encoding/decoding. The above table profiles the entire
MapImage#savemethod (which includes encode and decode).
- Do we want to change the config layout to better allow for support of other image formats in the future (i.e. lossless/lossy webp)? Or should we leave that for when other image formats are implemented?
I think it would be worth exploring memory-mapped files (two variants: no compression or lz4). It could net orders of magnitude improvement to write and load speed.