I tried Marlin 0.9.0 and it seems lighting fast, sometimes more than 2x faster than 0.8.2 when drawing polygon borders, using default settings. I wonder where this speedup might come from. You mentioned "higher sub-pixel accuracy (256x8) + larger tiles (128x64)" in the release notes, but even after I set sun.java2d.renderer.subPixel_log2_X back to 3 (to revert to 8x8 subpixels) I still got the 2x speedup.
By the way, what is the reason for using non-uniform subpixels and tile sizes in x and y directions? The 256x8 subpixel default setting seems particularly strange. Does this mean that near-vertical lines are smoothed differently than near-horizontal ones?
It would be great to set the renderer settings on a per-graphics basis (I am using MarlinGraphics2D), is that possible? Or would that hurt performance?
KEY_RENDERING:| Rendering | KEY_RENDERING |
VALUE_RENDER_QUALITYVALUE_RENDER_SPEEDVALUE_RENDER_DEFAULT |
Thanks for the explanation. We use VolatileImage to render layers of polygons (administrative areas of a map). The fill is performed without AA, the borders are drawn with AA. This can be done because the borders are drawn using a 2px thick opaque stroke that completely hides any jagged edges produced by the non-AA fill.On a particular location I measured the following rendering times:This explains why upgrading marlin from version 0.8.2 to 0.9.1 more than doubled the performance in this particular workload. Increasing the tile size to the maximum of 256x256 results in even higher performance, almost reaching the non-AA version.
- fill without AA: 10 ms
- draw with AA, 32x32 tile size: 124 ms
- draw with AA, 128x64 tile size: 46 ms
- draw with AA, 256x256 tile size: 32 ms
- draw without AA: 26 ms
What are the drawbacks of using large tiles? Higher memory usage? Does is affect the performance of drawing small images? (e.g. we render map feature labels on small BufferedImages like 100x20 pixels, is a 256x256 tile size suitable for that?)