From bourges.laurent at gmail.com Fri Mar 22 04:35:34 2013 From: bourges.laurent at gmail.com (=?ISO-8859-1?Q?Laurent_Bourg=E8s?=) Date: Fri, 22 Mar 2013 12:35:34 +0100 Subject: [OpenJDK Rasterizer] Fwd: sun.java2D.pisces big memory usage (waste ?) In-Reply-To: References: Message-ID: Here is the mail I sent to 2d-dev list. ---------- Forwarded message ---------- From: Laurent Bourg?s Date: 2013/3/22 Subject: sun.java2D.pisces big memory usage (waste ?) To: 2d-dev at openjdk.java.net 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/graphics-rasterizer-dev/attachments/20130322/41b70a19/attachment.html From bourges.laurent at gmail.com Mon Mar 25 02:01:31 2013 From: bourges.laurent at gmail.com (=?ISO-8859-1?Q?Laurent_Bourg=E8s?=) Date: Mon, 25 Mar 2013 10:01:31 +0100 Subject: [OpenJDK Rasterizer] Fwd: sun.java2D.pisces big memory usage (waste ?) In-Reply-To: References: Message-ID: Dear Donald, Dalibor and 2D-dev members, During the week end, I looked (deeply) at java2D.pisces renderer (linux AA shape renderer) and I started improving huge memory allocations (int[], float[]) that has two impacts: - GC overhead - performance due to array resizing (arraycopy / grow) Who knows how pisces work and could support / sponsor me if I have any question ? I sent an email to 2d-dev and rasterizer mailing lists but got no answer: Is there anybody interested in that performance topic ? (Jim Graham, at least) Anyone could explain me the java2D AA code and its different implementations openjdk (pisces), oracle (ductus) ... ? Could such AA algorithm be performed by openGL / directx instead ? Best regards, Laurent ---------- Forwarded message ---------- From: Laurent Bourg?s Date: 2013/3/22 Subject: sun.java2D.pisces big memory usage (waste ?) To: 2d-dev at openjdk.java.net 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/graphics-rasterizer-dev/attachments/20130325/395e5aa5/attachment.html From xerxes at zafena.se Mon Mar 25 04:41:33 2013 From: xerxes at zafena.se (=?windows-1252?Q?Xerxes_R=E5nby?=) Date: Mon, 25 Mar 2013 12:41:33 +0100 Subject: [OpenJDK Rasterizer] Fwd: sun.java2D.pisces big memory usage (waste ?) In-Reply-To: <51502F67.1030506@zafena.se> References: <51502F67.1030506@zafena.se> Message-ID: <515037ED.7000407@zafena.se> 2013-03-22 12:35, Laurent Bourg?s skrev: > Here is the mail I sent to 2d-dev list. > > ---------- Forwarded message ---------- From: *Laurent Bourg?s* > Date: 2013/3/22 Subject: sun.java2D.pisces big memory usage (waste ?) To: 2d-dev at openjdk.java.net > > > 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 ? I have tested most of the OpenJDK Java2D back-ends in order to find ways to hardware accelerate Java2D on mobile OpenGL ES devices. http://www.raspberrypi.org/phpBB3/viewtopic.php?p=233052#p233052 The default X11 pipeline is not the fastest but it is the most stable open-source implementation and that?s why it is still the default. You can switch to the XRender Java2D pipeline in OpenJDK by passing -Dsun.java2d.xrender=True The XRender backend is developed by Clemens Eisserer and work quite well on hardware with good GPU XRender drivers. Unfortunally this pipeline do not work well on hardware with software CPU fallback when X11 XRender extensions are unavailable. http://linuxhippy.blogspot.se/ - Clemens Eisserer blog. or -Dsun.java2d.opengl=True This is the old OpenGL pipeline that target old fixed function desktop GPU's, note that all recent OpenGL GPU's are designed to be programmed using "shader" based programmable pipelines thus this java2d opengl pipeline is now out-dated and do not work on mobile OpenGL ES hardware. There exist one attempt outside OpenJDK to accelerate Java2D using modern OpenGL calls, this approach renders much faster compared to the closed source Ductus pipeline. http://brandonborkholder.github.com/glg2d/ GLG2D implements a GLG2DCanvas and a GLG2DPanel that you can use to wrap existing JComponents in order to get the components rendered using hardware acceleration. Example: https://gist.github.com/brandonborkholder/3909397 > - 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 > Like you discovered most of the Java2D back-ends still make quite heavy use of the software fall-back in sun.java2d.loops.* . On mobile OpenGL ES hardware none of the above pipelines are currently able to make use of the GPU thus Java2D do have a problem to scale and operate fast on mobile devices and the latest OpenGL GPU drivers. The GLG2D implementation is almost OpenGL ES 2 ready but it require replacing some OpenGL 2 desktop specific code with OpenGL ES 2 compatible code. Cheers Xerxes From dalibor.topic at oracle.com Mon Mar 25 07:37:42 2013 From: dalibor.topic at oracle.com (Dalibor Topic) Date: Mon, 25 Mar 2013 15:37:42 +0100 Subject: [OpenJDK Rasterizer] Fwd: sun.java2D.pisces big memory usage (waste ?) In-Reply-To: References: Message-ID: <51506136.4020909@oracle.com> On 3/25/13 10:01 AM, Laurent Bourg?s wrote: > Dear Donald, Dalibor and 2D-dev members, > I sent an email to 2d-dev and rasterizer mailing lists 2d-dev is the right mailing list for this kind of questions, I think. You may want to get in touch with Denis Lila from Red Hat, who has in the past worked on performance improvements in this area. cheers, dalibor topic -- Oracle Dalibor Topic | Principal Product Manager Phone: +494089091214 | Mobile: +491737185961 Oracle Java Platform Group ORACLE Deutschland B.V. & Co. KG | K?hneh?fe 5 | 22761 Hamburg ORACLE Deutschland B.V. & Co. KG Hauptverwaltung: Riesstr. 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Gesch?ftsf?hrer: J?rgen Kunz Komplement?rin: ORACLE Deutschland Verwaltung B.V. Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Astrid Kepper, Val Maher Green Oracle Oracle is committed to developing practices and products that help protect the environment From philip.race at oracle.com Mon Mar 25 09:54:17 2013 From: philip.race at oracle.com (Phil Race) Date: Mon, 25 Mar 2013 09:54:17 -0700 Subject: [OpenJDK Rasterizer] [OpenJDK 2D-Dev] Fwd: sun.java2D.pisces big memory usage (waste ?) In-Reply-To: <51506136.4020909@oracle.com> References: <51506136.4020909@oracle.com> Message-ID: <51508139.9000507@oracle.com> On 3/25/2013 7:37 AM, Dalibor Topic wrote: > On 3/25/13 10:01 AM, Laurent Bourg?s wrote: >> Dear Donald, Dalibor and 2D-dev members, >> I sent an email to 2d-dev and rasterizer mailing lists On Friday .. I suspect no one got around to even reading it yet. I hadn't even seen it. > 2d-dev is the right mailing list for this kind of questions, I think. Yes, I think it sufficient to continue on the original thread there. And we should retire graphics-rasterizer-dev .. > > You may want to get in touch with Denis Lila from Red Hat, who has in > the past worked on performance improvements in this area. Denis interned at RedHat for a year but isn't there now (SFAIK). -phil. > > cheers, > dalibor topic > >