[jdom-interest] Huge slowdown when reading > 15 xml files

Paul Libbrecht paul at ags.uni-sb.de
Wed Nov 21 00:59:06 PST 2001


Well.... we do this all the time: our current "database fallback" is 
precisely a large collection of JDOM documents in memory. The only thing 
you should change is the parser... choosing the AElfred parser as 
delivered in Saxon was the best way (and the fastest as well).
I believe however that it might forget a few things... including possibly 
comments. But nothing of the essential XML content.

Paul



On Mardi, octobre 23, 2001, at 03:19 AM, philip.nelson at omniresources.com 
wrote:

>
>> I have a program that reads in xml files from a directory and
>> builds them
>> into jdom documents.
>>
>> As it does .build(filename), the system gets slower and
>> slower.  After about
>> 18 xml files it basically stops working and hangs.
>
> I wanted to at least let you know I had taken a look at this and confirmed
> what you are experiencing.  I have a couple of loose ends to follow up on
> but it appears these documents pick on a truly worst case scenario for 
> JDOM
> because of how xerces slices up these documents.  Yes, you have all the <
> and > characters escaped but xerces is still slicing this up in to massive
> numbers of calls to characters(char[], int, int) in the SAX 
> ContentHandler.
> That is unfortunate but there is nothing JDOM can do about it, at least 
> that
> I am aware of.  What is even more unfortunate is that each of these calls
> puts a new String into an ArrayList, most of which are 1 to 5 characters 
> in
> length.  As you can imagine, dividing a 100K document into 1-5 character
> long individual strings is not the most efficient way to build it =8^(.
> This we can improve on though and I think we should.




More information about the jdom-interest mailing list