xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <thomas.dewe...@gmail.com>
Subject Re: Performance-Issue, group elements
Date Sat, 24 Nov 2012 12:22:32 GMT
Hi MrG,

   Do you know what sort of container nodes is?  If it's something like a
linked list it may be that simply getting the elements out of it is taking
your 8sec.
With a linked list getting element 900 the way you are will take 900
pointer traversals so getting 1000 elements out of the container with 'get'
would take
~1 million operations (and it goes up quickly from there).  In general our
appendChild is a quick operation so I wouldn't expect that to be causing
your problems.

   Other things you might consider, does the 8sec include rendering the 1K
elements?  That might be believable depending on the complexity of the
elements.
You might also try timing the loop removing the appendChild call (i.e.
seeing how long calling nodes.get(i) takes when you iterate across the
whole container).

On Thu, Nov 22, 2012 at 3:49 AM, MrG <mail@realisingvisions.com> wrote:

> Element group =
> editor.doc.createElementNS(editor.svgNS, SVGConstants.SVG_G_TAG);
> group.setAttributeNS(null, "id", groupID);
>
> for(int i=0; i<nodes.size(); i++) {
>         group.appendChild(nodes.get(i));
> }
>
> editor.doc.getRootElement().appendChild(group);
> -----------------------------------------------------------
>
> this takes a lot of time > 8s
>
> is there a way to optimize grouping elements?
>
> thanks!
>
>
>
>
> --
> View this message in context:
> http://batik.2283329.n4.nabble.com/Performance-Issue-group-elements-tp4655381.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

Mime
View raw message