Yup. It's a concern. Best way around it we've found is to set a bunch of
system properties to shortcut the factory creation process as in:
System.setProperty("javax.xml.transform.TransformerFactory",
"org.apache.xalan.processor.TransformerFactoryImpl");
System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory",
"org.apache.xerces.jaxp.SAXParserFactoryImpl");
System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration",
"org.apache.xerces.parsers.XML11Configuration");
Rick Bullotta
CTO
Lighthammer Software (http://www.lighthammer.com)
-----Original Message-----
From: Curtiss Howard [mailto:curtiss.howard@xxxxxxxxx]
Sent: Friday, December 17, 2004 10:02 AM
To: xerces-j-user@xxxxxxxxxxxxxx
Subject: Xerces2 DocumentBuilderFactory.setAttribute() is very slow
I was profiling some code recently and found that the Xerces2's JAXP
DocumentBuilderFactory setAttribute() method is very slow on my
machine (Athlon XP 2500+, 1GB RAM). It takes approximately 50ms (!)
to call setAttribute(), which I do about five times when setting up my
DocumentBuilderFactory. I realize that in terms of long-running
applications this overhead is negligible, but in the case of
short-lived applications (of which I intend to do), it is quite
noticeable.
I glanced through
org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.java and it looks
like the culprit is the manner in which features/properties are
checked for correctness: an instance of DOMParser is created and the
feature/property is passed to it. This wouldn't be a bad thing if the
cost of creating a DOMParser wasn't, relatively speaking, so
expensive.
I'm throwing this issue out on the user mailing list because I'm not
sure if it would be appropriate to mention it on the developer list.
At any rate, is anyone aware of this issue? Is anything being done to
address it? If not, would I be able to submit my own patch for the
problem?
Thanks,
Curtiss Howard
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xxxxxxxxxxxxxx
For additional commands, e-mail: xerces-j-user-help@xxxxxxxxxxxxxx
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|