[jdom-interest] AttributeList performance

Michael Kay mike at saxonica.com
Sun Apr 24 10:18:43 PDT 2005

> we have been running into a performance problem caused by the O(N) 
> performance characteristic
> of the JDOM AttributeList in the indexOf method.  This affects both 
> insertions and lookup of Attributes.
> Our application uses hundreds of Elements, each of which may 
> have 20-40 attributes.

I think it's very common for XML data models to use serial searching to
locate an attribute, based on the fact that very few elements have more than
three or four attributes. It's also common, I think, to use serial searching
for child elements, so switching from attributes to elements won't
necessarily help. Short of implementing your own custom OM implementation, I
suspect your best option is to add a level of hierarchy so that the 40
attributes are distributed into clusters attached to different child

It would be interesting to see your data structure so see why you have so
many attributes: is there something unusual about your information, or are
you just modelling it in an unusual way?

Michael Kay

More information about the jdom-interest mailing list