-
-
Notifications
You must be signed in to change notification settings - Fork 17
Tuning options
Laurent Bourgès edited this page Dec 20, 2016
·
6 revisions
Here are the Marlin tuning options using following system properties:
- -Dsun.java2d.renderer.useThreadLocal=true|false (true by default): allow marlin to use ThreadLocal (TL) variables (true) or ConcurrentLinkedQueue (CLQ) (false) to store its rendering context (one per concurrent rendering thread). TL are 10% faster but may waste memory in web server environnement (high number of threads so many contexts)
- -Dsun.java2d.renderer.pixelsize=2048 (2048 by default): adjust initial capacity of rendering arrays depending on the typical image size/width (in fact largest shape's area). If you are drawing very large images (high resolution maps), please set this setting to your 'average' map size (4096x4096 or more ...); but do not set it too high to avoid wasting unused memory ...
FYI, the typical size per RenderingContext is 512K (pixelsize=2048) and 1Mb for pixelsize=4096 ...
For example to use CLQ mode (web server) optimized for large image rendering:
java -Xbootclasspath/a:[path]/marlin-x.y.jar
-Dsun.java2d.renderer.useThreadLocal=false
-Dsun.java2d.renderer.pixelsize=8192
-Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine ...
The Marlin renderer has many (internal) settings for tuning, debugging & quality:
INFO: ===============================================================================
INFO: Marlin software rasterizer = ENABLED
INFO: Version = [marlin-0.7.5-Unsafe]
INFO: sun.java2d.renderer = org.marlin.pisces.MarlinRenderingEngine
INFO: sun.java2d.renderer.useThreadLocal = true
INFO: sun.java2d.renderer.useRef = soft
INFO: sun.java2d.renderer.edges = 4096
INFO: sun.java2d.renderer.pixelsize = 2048
INFO: sun.java2d.renderer.subPixel_log2_X = 3
INFO: sun.java2d.renderer.subPixel_log2_Y = 3
INFO: sun.java2d.renderer.tileSize_log2 = 5
INFO: sun.java2d.renderer.tileWidth_log2 = 5
INFO: sun.java2d.renderer.blockSize_log2 = 5
INFO: sun.java2d.renderer.forceRLE = false
INFO: sun.java2d.renderer.forceNoRLE = false
INFO: sun.java2d.renderer.useTileFlags = true
INFO: sun.java2d.renderer.useTileFlags.useHeuristics = true
INFO: sun.java2d.renderer.rleMinWidth = 64
INFO: sun.java2d.renderer.useSimplifier = false
INFO: sun.java2d.renderer.clip.curves = false
INFO: sun.java2d.renderer.doStats = false
INFO: sun.java2d.renderer.doMonitors = false
INFO: sun.java2d.renderer.doChecks = false
INFO: sun.java2d.renderer.useLogger = false
INFO: sun.java2d.renderer.logCreateContext = false
INFO: sun.java2d.renderer.logUnsafeMalloc = false
INFO: sun.java2d.renderer.cubic_dec_d2 = 1.0
INFO: sun.java2d.renderer.cubic_inc_d1 = 0.4
INFO: sun.java2d.renderer.quad_dec_d2 = 0.5
INFO: Renderer settings:
INFO: CUB_DEC_BND = 8.0
INFO: CUB_INC_BND = 3.2
INFO: QUAD_DEC_BND = 4.0
INFO: INITIAL_EDGES_CAPACITY = 98304
INFO: INITIAL_CROSSING_COUNT = 1024
INFO: ===============================================================================
In short:
- useRef [hard|soft|weak] controls how renderer contexts are kept in cache: GC clears weak references quite fast, soft only if OOM occurs and hard reference are never cleaned up.
- subPixel_log2_X/Y ~ subpixel number: 3 means 2^3 ie 8x8 subpixels, 2 means 2^2 ie 4x4 subpixels and 4 means 16x16 (slower)
- tileSize/tileWidth_log2 ~ tile height/width: 5 means 2^5 ie 32x32 tiles. You can try increasing it up to 256x256 (8) and use asymetric tiles 32x128
- doChecks is useful for debugging purposes to check internal array
- doStats may help gathering rendering statistics that are logged when the JVM exits (shutdown hook)