[OpenJDK 2D-Dev] sun.java2D.pisces big memory usage (waste ?)
Laurent Bourgès
bourges.laurent at gmail.com
Mon Apr 8 07:48:28 UTC 2013
Andrea,
Any feedback from anybody else ?
Here are J2D Bench results:
http://jmmc.fr/~bourgesl/share/java2d-pisces/j2DBench/
Depending on the test, performance gains varies from 20% to 100% !
I think it could be nice if you can perform tests (regression and
benchmarks using MapBench, J2DBench, Java2D demos).
I still have to enhance cleanup / tuning my code (stats, initial array
sizes ...) and cache eviction (memory cleanup) using Weak references or
manual cleanup using timestamps ...
To test regression, I propose you to enhance your MapBench class to save
image results (randomly in tests) and compare them after the test run
(image diff) even when multiple threads are in use.
If you apply my patch, take care of the following main settings:
useThreadLocal should be disabled in a web container (to avoid too much
memory waste): a RendererContext represents ~ 2Mb:
rowAARLE = new int[INITIAL_Y_ARRAY][INITIAL_ARRAY]; // ~2Mb +1 to avoid
recycling such shared arrays
PiscesConst:
/** use ThreadLocal or ConcurrentLinkedQueue to get the thread
RendererContext */
static final boolean useThreadLocal = true;
Initial RendererContext array capacity:
// +1 to avoid recycling such shared arrays
static final int INITIAL_ARRAY = 256 + 1;
static final int INITIAL_Y_ARRAY = 2048 + 1;
static final int INITIAL_LARGE_ARRAY = 16384 + 1; // large
Laurent
2013/4/7 Andrea Aime <andrea.aime at geo-solutions.it>
> On Fri, Apr 5, 2013 at 4:32 PM, Laurent Bourgès <bourges.laurent at gmail.com
> > wrote:
>
>> Dear all,
>>
>> Here is my first pisces (beta) patch (webrev):
>> http://jmmc.fr/~bourgesl/share/java2d-pisces/webrev-1/
>>
>> I succeed in fixing memory usage by having only 1 pisces instance
>> (Renderer, stroker, iterator ...) per RendererContext (GC friendly).
>>
>> Impressive results between small and large drawings:
>>
>
> Good stuff. Is there anything I can do to help? I do have an up to date
> version of JDK 8 sources on my disk, maybe I could
> try to apply the patch and take it for a spin in a real GeoServer and see
> how it goes.
>
> By the way, wondering, is there any other benchmark to try out?
> A possibly interesting one is this, where the author re-coded some
> selected methods of Graphics2D for maximum performance
> (but sometimes lower antialiasing quality) and created a applet to compare
> the results in a number of synthetic test cases:
> http://www.randelshofer.ch/oop/graphics/
>
> Cheers
> Andrea
>
>
> --
> ==
> Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
> information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39 339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
More information about the core-libs-dev
mailing list