Well, I find something that may interest some of you and I wish you could tell me what you think about my idea.
I had a look into the node classes and GenericText in particular. I saw that for each setNodeValue, an event is Fired and propaged to parent elements. What I first tryed to do was to implement my own class redifining the setNodeValue but I didn't managed to do this. I just implemented another method : (thank to the debuger) I found that SVGOMDocument had a getEventsEnabled function so... iuf there is a getter there should be a setter. So in my application I cast my svgDoc to a SVGOMDocument and call setEventsEnabled(false); I then loop to perform each single update "without" firing event (they are fired but not taken into account). Before the last update I just call setEventsEnabled(true). This line allow the last event fred to be taken into account and the tree is updated. Maybe this method is not the best but it works. Can you tell me what you think about this ? I'll take this as a solution as I don't have lot of time available but I'd like to discuss about this. Regards, Julien From: [EMAIL PROTECTED] To: [email protected] Subject: Re: Slow updates Date: Wed, 17 Sep 2008 11:36:17 +0000 Hi there, Tony : > Another way to improve performance is by: > - whenever possible, group the things that need to be changed > - when you want to update > * detach that group from the DOM aka rendering tree > * do your update (add new element, sub node, modify existing) > * attach the group back > * re render the DOMFor the refresh and rendering : My logfile only give two line corresponding to refresh and that comes from "UpdateManagerListener.updateCompleted". I don't know why I have only 2 "refreshes" as my canvas is supposed to be dynamic. That is why I think that the whole loop is taken as a single modification but I must be wrong. When you say "detach" do you think that removing the RenderingListener is enought ? My first idea was : setDocumentState(ALWAYS_STATIC); update setDocumentState(ALWAYS_DYNAMIC); But this is not doing anything. Thomas : I still try to get beter results with my updates and here are some more informations : >If the '78ms' is to update and render a list of >~100 text elements then it's probably what I expect from >Batik (unfortunately). Unfortunatly, 78ms is the time to update a single label. The full update of the list took about 5 seconds. The "0 ms" one is normal : as I refresh the labels after deleting an element, there is no text to update and so no time is spents there. I tryed different implementations : - When i use createElement instead of createElementNS, everything is so fast.. but not displayed. - setTextContent is really not the solution with 12sec for 50 actions - kill the node and recreate it give same performance as setNodeValue Basically what i currently do is : 1. I put text nodes in a map to avoid useless getChildNodes. text node are childrens of elementsNS 2. I delete an action. This triggers the update 3. I try to stop every slowing thing ( well it is not as simple as I tought) 4. I update each Node in my map with setNodeValue 5. I try put everything in initial state I'll also try to explain what is the application supposed to do in a better way ^^ I have a list of Actions. My SVG Canvas is a representation of pipes with equipments like pumps, captors ... Action are applied on those equipment and they have to be done in a certain order. The text added to the action represents this order. So when I remove an action, all action have to be renamed : For instance if I have action 1,2, and 3 : when I delete action 1 then 2 becomes 1 and 3 become 2. 2 -> 1 and 3->2. That is what i need to represent on the SVG Here you can have a snapshot a a very little part of my SVG canvas, and the full svg http://julien.beghin.free.fr/part_of_canvas.JPG http://julien.beghin.free.fr/output.svg I don't know if this will help but any advices or questions are welcome. This problem is a good way for me to discover how Batik really works... unfortunatly i really need performance here and I can't post the full application. Thanks, Julien To: [email protected] CC: [email protected]; [EMAIL PROTECTED] Subject: Re: Slow updates From: [EMAIL PROTECTED] Date: Wed, 17 Sep 2008 06:17:45 -0400 Hi Julien, <[EMAIL PROTECTED]> wrote on 09/17/2008 04:44:42 AM: > Still in the business part of my application, I may need to perform > an update on a list of text elements in my canvas. [...] > This represent from 50 to 100 elements that can need to be updated. > > Everything works fine but it tooks real long time to update the complete list. > I also added some "simple" timer[...] Here are the results > Updating action labels > -> Updating action label 1 (0 ms) > -> Updating action label 2 (94 ms) > -> Updating action label 3 (78 ms) If the '78ms' is to update and render a list of ~100 text elements then it's probably what I expect from Batik (unfortunately). [...] > -> Updating action label 9 (438 ms) [...] > -> Updating action label 30 (625 ms) > ... > As you can see, there are very long update like #30 with 625ms and > the first one is at 0ms.... These almost certainly represent Java Garbage collection events. I suspect that the first one (0ms) is a bug in the timing code (or the change ends up being a no-op). > I am new to Batik and i must have done something wrong ( I hope that > is the problem... ). I also hope, someone will > figure out what is happening there. Without the full app it's hard to say for certain but in general Batik's text layout is slow. The reasons for this are complex but boil down to some slowness in the underlying Java2D API's and the fact that Batik doesn't have a 'really simple' text layout path. Qui vous permet d'enregistrer la TV sur votre PC et lire vos emails sur votre mobile ? la réponse en vidéo la réponse en vidéo _________________________________________________________________ Téléphonez gratuitement à tous vos proches avec Windows Live Messenger ! Téléchargez-le maintenant ! http://www.windowslive.fr/messenger/1.asp
