> Node parent = textElement.getParentNode();
> Node stub = parent.getOwnerDocument().createElement("g");
> // unlink element
> parent.replaceChild(stub, textElement);
> // run your updates
> // re link element
> stub.getParentNode().replaceChild(textElement, stub);

Trying above code did reduce the CPU usage by 3 to 4% but now replace child
becomes a problem by taking up 35% of cpu time. I get an array of
textElements and have to iterate over the array in a loop to call
(unlink->update->replace) for each text element.  So taking the replaceChild
function out of the loop seems impossible. 

Is it possible to take this replaceChild method call out of the loop, when i
just receive an array of text elements?

Thanks,
Naveed

noni_4444 wrote:
> I have a routine where i update several DOM elements inside an update
> manager
> thread. The problem faced
> is that setAttribute and setNodeValue methods take a lot of CPU time.
> 
> An earlier post says:
> 
> "Disconnect the tree from the document before making the changes.  This
> avoids the overhead of keeping the GVT tree in synch with every change"
> 
> In my case i am updating the multiple attributes of different Elements
> repeatedly. How can i detach the attributes of an element before making
> the
> changes. 
> If i do it, it would mean that i do something like
>  
> for (1 -> n)
> {
>  Get current element from array
>  Detach attributes of element             //which dom api method to
> call????
>  Update multiple attributes of this element
>  Attach attributes of element             //which dom api method to
> call????
> }
>  
> Any pointers, links, references would be helpful.
> 
> Thanks
> Naveed


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
View this message in context: 
http://www.nabble.com/Help-%21-how-to-make-updates-to-dom-more-efficient---tf4528109.html#a12921244
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to