xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Staub <est...@silknet.com>
Subject RE: Performance and thread safety in Xerces
Date Thu, 29 Jun 2000 13:37:36 GMT
"concatenate the children of the attribute node"?
I must be missing something... under what conditions are there more than
one?  And even if there are cases where there are more than one child, in
the vast majority of cases, isn't there only one?  

-Ed Staub

-----Original Message-----
From: Andy Clark [mailto:andyc@apache.org]
Sent: Wednesday, June 28, 2000 4:30 PM
To: general@xml.apache.org
Subject: Re: Performance and thread safety in Xerces


Dennis Thrysoe - Netnord A/S wrote:
> I my concrete case I have some code that calls ElementImpl.getAttribute()
> about 320,000 times. This code takes a bit long, and creates a total of
> almost 600,000 objects.

I would imagine that your 600,000 objects come from the fact that
the getAttribute method has to concatenate the children of the
attribute node in order to return you a string. So save the 
memory you should use getAttributeNode and then query the
children yourself.

> The other thing relates to the thread safety of Xerces. I have two
seperate
> threads parsing two different XML files. Still I seem to get race
conditions
> on some arrays:

Access to the parser and the DOM are *not* thread-safe. You still
have to manage locks in order to ensure that multiple threads are

  1) not using the parser at the same time
  2) not editing a DOM document at the same time

Now, if there are static members that are used in the code and
access to them is not synchronized, then that could be causing
the race condition problems that you are seeing. Let us know if
you deduce the cause of your problem.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

Mime
View raw message