You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Mikael Helbo Kjær <mh...@dia.dk> on 2000/02/18 13:21:46 UTC
[Xerces-J] problem
Hi everyone.
I`m developing a Java Xml application and I`m testing different Java XML
parser. I`ve tested the Oracle XML Parser (fastest so far, but uses a lot of
memory) and Suns jaxp (slower, but parses big files fastest) and I`m of
course also testing the Xerces-J parser (I`ve followed the project since
December), but I´ve encountered a major problem when parsing
(non-validating) a 9 MB file, the parsing is incredibly slow (995562 ms),
which is clearly unacceptable for any application in terms of response time.
I`ve used the following code and it runs in a Jdk1.2.2 (using HotSpot 1.0.1)
under Window 2000 Server Edition:
//XercesTest.java
import org.w3c.dom.*;
import org.apache.xerces.parsers.*;
import org.xml.sax.InputSource;
import java.io.*;
import java.net.*;
public class XercesTest extends Object
{
static public void main(String[] argv)
{
long now, after, usedtime;
try{
InputSource biginput = new InputSource(new
FileInputStream("C:\\kurs.xml"));
DOMParser parser = new DOMParser();
parser.setValidating(false);
now = System.currentTimeMillis();
parser.parse(biginput);
after = System.currentTimeMillis();
usedtime = after-now;
System.out.println("Kurs.xml: "+usedtime);
parser.reset();
}catch( Exception e )
{
e.printStackTrace();
}
}
}
I don`t know if I`m doing something wrong or if this is a bug...
Mikael Helbo Kjær
Software Developer @ DIA a/s
Re: [Xerces-J] problem
Posted by Wong Kok Wai <wo...@pacific.net.sg>.
Two ways you can try:
1) Wrap your FileInputStream with a BufferedInputStream, like:
InputSource biginput = new InputSource(new
BufferedInputStream(new
FileInputStream("C:\\kurs.xml")));
2) Use SAX
Mikael Helbo Kjær wrote:
> Hi everyone.
> I`m developing a Java Xml application and I`m testing different Java XML
> parser. I`ve tested the Oracle XML Parser (fastest so far, but uses a lot of
> memory) and Suns jaxp (slower, but parses big files fastest) and I`m of
> course also testing the Xerces-J parser (I`ve followed the project since
> December), but I´ve encountered a major problem when parsing
> (non-validating) a 9 MB file, the parsing is incredibly slow (995562 ms),
> which is clearly unacceptable for any application in terms of response time.
RE: [Xerces-J] problem
Posted by "George T. Joseph" <gt...@peakin.com>.
Try turning HotSpot off and allocating a larger initial heap.
java -classic -Xms20m .....
george
-----Original Message-----
From: Mikael Helbo Kjær [mailto:mhk@dia.dk]
Sent: Friday, February 18, 2000 7:22 AM
To: 'xerces-dev@xml.apache.org'
Subject: [Xerces-J] problem
Hi everyone.
I`m developing a Java Xml application and I`m testing different Java XML
parser. I`ve tested the Oracle XML Parser (fastest so far, but uses a lot of
memory) and Suns jaxp (slower, but parses big files fastest) and I`m of
course also testing the Xerces-J parser (I`ve followed the project since
December), but I´ve encountered a major problem when parsing
(non-validating) a 9 MB file, the parsing is incredibly slow (995562 ms),
which is clearly unacceptable for any application in terms of response time.
I`ve used the following code and it runs in a Jdk1.2.2 (using HotSpot 1.0.1)
under Window 2000 Server Edition:
//XercesTest.java
import org.w3c.dom.*;
import org.apache.xerces.parsers.*;
import org.xml.sax.InputSource;
import java.io.*;
import java.net.*;
public class XercesTest extends Object
{
static public void main(String[] argv)
{
long now, after, usedtime;
try{
InputSource biginput = new InputSource(new
FileInputStream("C:\\kurs.xml"));
DOMParser parser = new DOMParser();
parser.setValidating(false);
now = System.currentTimeMillis();
parser.parse(biginput);
after = System.currentTimeMillis();
usedtime = after-now;
System.out.println("Kurs.xml: "+usedtime);
parser.reset();
}catch( Exception e )
{
e.printStackTrace();
}
}
}
I don`t know if I`m doing something wrong or if this is a bug...
Mikael Helbo Kjær
Software Developer @ DIA a/s