[jdom-interest] performance with creating a document

elephantwalker elephantwalker at home.com
Mon May 21 19:33:16 PDT 2001


Jason,

The elements here are just the result of the bean creating the jdom
document. Fortunately, I didn't have to type all of this ;). Its the element
creation, and addContent's that take so long. If I get the same data with a
jsp, its much faster...even though we are handling essentially the same
data.

Is there a faster way to create a jdom document? Can I pre-create the
elements, and get the elements from a pool of pre-created elements? Is it
faster to use text content or attributes in jdom (instead of an attribute
value, use a text content)? Would it be better to pre-create a "template"
jdom document, and clone it to create my document? I'm just looking for some
ways to speed up the performance but I don't want to go down a rat-hole that
won't pan out if there is already some know-how on how to best create
large/content rich documents.

regards,

the elephantwalker

-----Original Message-----
From: Jason Hunter [mailto:jhunter at collab.net]
Sent: Monday, May 21, 2001 7:10 PM
To: elephantwalker
Cc: jdom
Subject: Re: [jdom-interest] performance with creating a document


> 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" />
>                 </chemmodel:item>
>            .....
>         </chemmodel:list>
>      </chemmodel:item>
>      ....
>   </chemmodel:list>
> </chemmodel:chemmodel>
>
> 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?

When you say slow do you mean in execution time or in lots of typing?

-jh-




More information about the jdom-interest mailing list