You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by th...@kodak.com on 2007/02/02 12:14:41 UTC

Re: Batik performance issue

Hi Blaise,

Blaise KISS <bl...@steria.com> wrote on 01/25/2007 10:07:13 AM:

> I have a performance problem with Batik, maybe this is a known issue,
> so maybe you can help.
> 
> - I have an SVG document (ALWAYS_DYNAMIC) with many text nodes (>100)
> - I intend to update these DOM node very frequently
> - I use getUpdateManager().getUpdateRunnableQueue().invokeLater(this);
> - and in the posted thred I use SetNodeValue(String) to update the 
> values.
> 
> My problem is that SetNodeValue takes an AWFUL lot of CPU time (I have
> no idea what it's doing) for every single value. I suppose it's
> because of refreshing the display.

   No actually it's due to laying out the text.  Do you update all the
texts in one Runnable or do you post a runnable for every text element?

> Since I'm updating my DOM by packets I thought there may be a way to
> update the node values in quick and dirty way first, and then have a
> call to to refresh the display. Is this possible ?

   We don't update the display (render the document) until after your
posted runnable completes.  However, in order to support the SVG DOM
(things like getBBox) we currently do the layout immediately. 

   Unfortunately for you text is one of the slowest pieces in Batik, 
however most of the time isn't even spent in our code it's spent in 
AttributedString methods.  I've spent a fair amount of time in the
code trying to speed it would need basically a complete rewrite to
make a significant performance improvement.

   If you are really desperate you could try doing all your independent
text elements as tspans in one text element.  You could then build a
new 'replacement' text element outside of the document tree and then
replace the text element in one DOM operation.  This might be faster
but you should test it...


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org