[OpenJDK 2D-Dev] drawPolyline performance

Clemens Eisserer linuxhippy at gmail.com
Wed Oct 29 09:30:38 UTC 2008


Hi Viet,

> I have a performance issue with drawPolyline whenever I try to use it on an
> array of 600K+ points.  Typically with the default stroke I have very good
> performance, 16ms for 600K+ points.  However when I tried to draw a thicker
> line, by setting graphics2d with a new BasicStroke, the plot couldn't even
> renderer, it stuck consuming memory and I eventually have to kill the task.
> Does anyone have any experience with this?
Its just a guess, but I think this is because a different code-path is taken.
For zero-width lines a PathStroker is used, whereas for more complex
strokes it uses the ShapeSpanIterator.

Hmm, 600k sounds an awful lot - something a normal monitor should not
even be able to display. (except you're trying to color it with
polylines ^^)
Is there a way to minimize the number of edges?

You could try drawing the polyLine to a BufferedImage and blit that
one later, with transparency this should give you the desired result.

- Clemens



More information about the 2d-dev mailing list