(original) (raw)

Dear all,

I recently profiled my swing application (Aspro2: http://www.jmmc.fr/aspro) using the netbeans profiler (OpenJDK8 / linux x64) and in contrary to Oracle JDK, it consumes a lot of memory in sun.java2D.pisces code as int[] or float[] arrays:

- Helpers.widenArray : 25Mb
- Renderer: 75 Mb (from AAShapePipe.draw)

Here are few profiler screenshots:
http://jmmc.fr/~bourgesl/share/pisces2D/


Aspro2 screenshot illustrating the plot that consumes a lot of memory:
http://jmmc.fr/~bourgesl/share/pisces2D/Capture-Aspro2.png

My application uses jfreechart that calls graphics2D.draw(shape) where shape is always a rectangle / line with antialiasing enabled.


Several questions:
- Why is the antialiasing performed in java code ? I mean is it possible to use OpenGL or XRender pipelines to perform such tasks ?
- Is there some docs explaining the java2D code and the different implementations (openjdk, oracle, xrender, opengl ...) ?

- how could I help improving that code (Renderer ...) to avoid so many array allocations / resizing (array sizing or using a thread context object to reuse allocated int[] / float[] arrays) ?

Does somebody work on that topic ? has some ideas to optimize that code (pisces) ?


Regards,
Laurent