List Info

Thread: Slow document creation




Slow document creation
country flaguser name
United States
2007-10-18 13:50:00
Hey guys,

I've got some simple graphics that a Java program is
generating.
Right now it is generating Java2D commands and I can see the
graphics in
a Swing window.
I eventually want the graphics to be saved out in an SVG
format so I
found batik.
I started using an SVGGraphics2D object to do this and it
works fine
except that it seems to take a long time the first time
through.
I don't know if this is Eclipse, or Java or what...
I put some println's in my code to see what part was hanging
it up and
it seems to be the following line...
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

When I run the code below I see here1-4 appear real fast but
then it
takes about 5 seconds before it moves on to
"here5".
/* begin example code */
System.out.println("here1");
DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
System.out.println("here2");
// Create an instance of org.w3c.dom.Document.
String svgNS = "http://www.w3.org/2
000/svg";
System.out.println("here3");
Document document = domImpl.createDocument(svgNS,
"svg", null);
System.out.println("here4");
// Create an instance of the SVG Generator.
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
System.out.println("here5");
/* end example code */

Any ideas why it is so slow?
Is it going out over the network?

------------------------------------------------------------
---------
To unsubscribe, e-mail: batik-users-unsubscribexmlgraphics.apache.org
For additional commands, e-mail: batik-users-helpxmlgraphics.apache.org


Re: Slow document creation
user name
2007-10-19 07:37:26
If it's really just the first time, you see the effect of
class-loading,
just-in-time (JIT) compiling and class initialization.
That's a Java
thing and there's not much you can do about it

Jeremias Maerki



On 18.10.2007 20:50:00 Frederich, Eric P21322 wrote:
> Hey guys,
> 
> I've got some simple graphics that a Java program is
generating.
> Right now it is generating Java2D commands and I can
see the graphics in
> a Swing window.
> I eventually want the graphics to be saved out in an
SVG format so I
> found batik.
> I started using an SVGGraphics2D object to do this and
it works fine
> except that it seems to take a long time the first time
through.
> I don't know if this is Eclipse, or Java or what...
> I put some println's in my code to see what part was
hanging it up and
> it seems to be the following line...
> SVGGraphics2D svgGenerator = new
SVGGraphics2D(document);
> 
> When I run the code below I see here1-4 appear real
fast but then it
> takes about 5 seconds before it moves on to
"here5".
> /* begin example code */
> System.out.println("here1");
> DOMImplementation domImpl =
> GenericDOMImplementation.getDOMImplementation();
> System.out.println("here2");
> // Create an instance of org.w3c.dom.Document.
> String svgNS = "http://www.w3.org/2
000/svg";
> System.out.println("here3");
> Document document = domImpl.createDocument(svgNS,
"svg", null);
> System.out.println("here4");
> // Create an instance of the SVG Generator.
> SVGGraphics2D svgGenerator = new
SVGGraphics2D(document);
> System.out.println("here5");
> /* end example code */
> 
> Any ideas why it is so slow?
> Is it going out over the network?


------------------------------------------------------------
---------
To unsubscribe, e-mail: batik-users-unsubscribexmlgraphics.apache.org
For additional commands, e-mail: batik-users-helpxmlgraphics.apache.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )