Performance-Issue, group elements

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

Performance-Issue, group elements

MrG
This post was updated on .
CONTENTS DELETED
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++) {
        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: [hidden email]
For additional commands, e-mail: [hidden email]