Sorry, i forgot to mention the number of elements i am trying to update. It's around 700.
Javid A clever person solves a problem. A wise person avoids it. -- Einstein -----Original Message----- From: Javid Alimohideen [mailto:[EMAIL PROTECTED] Sent: Saturday, June 25, 2005 9:30 PM To: [email protected] Subject: RE: javascript dynamic update very slow Thanks for the reply. Here is the piece of code that updates the SVG document. highwayData is an array of size more than 100. All the path elements have an unique ID and i change the attributes to a particular style based on the ID. Javascript Code: for(i=0;i<parseInt((highwayData.length)/5);i++) { System.out.println(highwayData[5*i]); segnode=svgDocument.getElementById(highwayData[5*i]); if(segnode==null) { continue; } fillstyle=congestionStyle[highwayData[5*i+1]]; segnode.setAttributeNS(null, "style",fillstyle); } Thanks, Javid A clever person solves a problem. A wise person avoids it. -- Einstein -----Original Message----- From: Thomas DeWeese [mailto:[EMAIL PROTECTED] Sent: Saturday, June 25, 2005 5:48 AM To: [email protected] Subject: Re: javascript dynamic update very slow Javid Alimohideen wrote: > I just started using Batik and i am in the process of creating an applet to > view an existing SVG document with javascript features. I got it to work > successfully but the dynamic updates handled by the javascript are very > slow. I have more than 100 path elements to update and it takes around 2-3 > minutes to update all the elements. Is this because my SVG uses javascript? Several minutes? That is _much_ slower than I would expect (easily two orders of magnitude for the types of changes most people make). What sort of changes are you making to the path elements? Are you just changing attributes or are you doing complex math? How large is the base document? Can you describe the basic structure of your changes? > Will converting javascript to java classes help in performance? It depends on exactly what you are doing. If it is really compute bound (i.e. it is your calculations that are the major bottleneck) then switching to Java could help. If it is mostly redrawing performance then switching to java won't help much. > I found out that javascript compiler converts .js files to java > classes and SVG can load external resurces like jar archives. > Can someone point me to some examples as how i could do this? Well Rhino (the javascript interpreter used in Batik) when not used in an Applet context will compile javascript on the fly to Java Bytecode. It's probably not as good as an offline compiler or better moving the code to real Java, but I would guess that for straight calculations it would be pretty good. I don't know anything about such a java script compiler so I can't really tell you how you would tie it in. I suspect that it wouldn't be trivial (in my experience such things are good for 'stand alone' code but problematic across interfaces). But since I don't know anything about this compiler it might be easy. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
