Performance-Issue, group elements

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Performance-Issue, group elements

This post was updated on .
The author has deleted this message.
Reply | Threaded
Open this post in threaded view

Re: Performance-Issue, group elements

DeWeese Thomas
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 <[hidden email]> 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++) {


this takes a lot of time > 8s

is there a way to optimize grouping elements?


View this message in context:
Sent from the Batik - Users mailing list archive at

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]