[jdom-interest] performance with creating a document

elephantwalker elephantwalker at home.com
Mon May 21 18:50:36 PDT 2001


I am jumping into the deep end here, and trying to use jdom handling of my
xml data. One thing that I have noticed is that creating a jdom document is
desperately slow.

Here is my working plan:

1. slsb gets some data from an cmp/entity and then does some very powerful
chemical engineering calculations (I got to pay the bills somehow) with a
calculation bean.
2. Calculation beans have a getDocument() method which creates a jdom xml
3. xalan is used to convert the jdom document into the web view (see the
latest really cool stuff in jdom-almost 7, this weekends build).

The slowest step is (2), creating the document, and all of its elements. Its
always faster to skip 2 and 3, and use jsp's (about three times faster). But
most of the "speeddown" is in the document creation step.

the elements looks something like this

<chemmodel:chemmodel name="C101" type="distillation">
  <chemmodel:specification name="rr" type="refluxratio" value="1.2" />
  <chemmodel:list name="stages" set="1:25" >
     <chemmodel:item name="1" type="stage">
       <chemmodel:variable name="t" type="temperature" value="325.25" />
       <chemmodel:variable name="p" type="pressure" value="1e5" />
	 <chemmodel:list name="compositions" set="water,methanol,ethanol" >
            <chemmodel:item name="water" type="component" >
		  <chemmodel:variable name="x" type="liquid-mole-fraction" value="0.3" />

So there is definitely some deep nesting, and lost of lists going on. No
text content, lots of attributes. It is really slow to build this structure
with Element e = new Element("list",ns);, then adding the various
attributes, and then adding the content to the parent element.

Is there a faster way creating/populating the jdom document?


the elephantwalker

More information about the jdom-interest mailing list