[jdom-interest] JAXP performance problems

Tatu Saloranta cowtowncoder at yahoo.com
Fri Sep 15 17:16:27 PDT 2006


--- "Klotz, Leigh" <Leigh.Klotz at xerox.com> wrote:

> You're quite right that people should reuse
> factories and even builders
> if possible, but unfortunately setting the system
> property does not
> help.
> Turn on -Djaxp.debug and see how many times it
> prints out the
> classloader.

Ok. This is then different from jaxp-handling of Stax
factory loading, which does stop if it finds the
system property (or the equivalent property from
jaxp.properties file).
Since that code seemed copied (all the way from the
original SAX package, as many pointed out), I thought
it would be the same as one used for SAX. I stand
corrected.

> That's the same number of times it will call
> String.valueOf(classloader).
> With Tomcat in place (4.1.x, 5.5), the call to
> classloader.toString() is
> incredibly expensive.
> So even setting the system property doesn't help in
> JDK 1.5.0
> implementation of JAXP because
> DocumentBuilderFactory and
> SAXParserFactory still invoke
> javax.xml.parsers.FactoryFinder, which you
> can see through -Djaxp.debug without even glancing
> at the Sun source
> code.

Yes, that sounds wrong.

> So the bug I fild with Sun is to fix this needless
> calculation of
> classloader.toString().

That does make lots of sense. I assumed you filed it
wrt. general design problem (which may be considered a
flaw... or at least a performance concern that should
be much better documented by JDK javadocs).

> And I think that repeating the advice to re-use
> factories is valuable.

I fully agree. Apologies if my reply was written in a
way that implied this was not the case: it is
definitely a valuable problem to point out.

It's more that I am frustrated that these problems do
not become common knowledge faster -- and your
emailing to point out the problem should work to make
it more widely known, which is a very good thing.

-+ Tatu +-



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the jdom-interest mailing list