<html><body>
<p><tt>>>>Jason just moved JDOMFactory out of package org.jdom.input and into<br>
org.jdom<<<</tt><br>
<tt>This is great.</tt><br>
<br>
<tt>>>>But I don't see how the static addContent methods help<<<</tt><br>
Well, in case of Attribute, there is a check for duplicate attribute. And in case of Element, there are other checks, like parents, canContains()... etc.<br>
I just wanted to skip these tests, as they are useless.<br>
<br>
<tt>>>>INITIAL_ARRAY_SIZE<<<</tt><br>
<tt>This can effectively be a performance bottleneck. In some cases, you may know in advance the number of children (ex: generated code, XMLS like serialization...) and having a ctor which takes it as a parameter can help optimize the performance and the memory.</tt><br>
<br>
Phil.<br>
<br>
<img src="cid:00__=4EBBE4ADDFF3A5658f9e8a93@triloggroup.com" width="16" height="16" alt="Inactive hide details for "Bradley S. Huffman" <hip@cs.okstate.edu>">"Bradley S. Huffman" <hip@cs.okstate.edu><br>
<br>
<br>
<table V5DOTBL=true width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img src="cid:10__=4EBBE4ADDFF3A5658f9e8a93@triloggroup.com" border="0" height="1" width="72" alt=""><br>
</td><td style="background-image:url(cid:20__=4EBBE4ADDFF3A5658f9e8a93@triloggroup.com); background-repeat: no-repeat; " width="1%"><img src="cid:10__=4EBBE4ADDFF3A5658f9e8a93@triloggroup.com" border="0" height="1" width="220" alt=""><br>
<ul>
<ul>
<ul>
<ul><b><font size="2">"Bradley S. Huffman" <hip@cs.okstate.edu></font></b>
<p><font size="2">18/02/2004 18:08</font></ul>
</ul>
</ul>
</ul>
</td><td width="100%"><img src="cid:10__=4EBBE4ADDFF3A5658f9e8a93@triloggroup.com" border="0" height="1" width="1" alt=""><br>
<font size="1" face="Arial">        </font><br>
<font size="2">        To:        </font><font size="2">phil@triloggroup.com</font><br>
<font size="2">        cc:        </font><font size="2">jdom-interest@jdom.org</font><br>
<font size="2">        Subject:        </font><font size="2">Re: [jdom-announce] JDOM Beta10 released</font></td></tr>
</table>
<br>
<br>
<tt>phil@triloggroup.com writes:<br>
<br>
> I'm very pleased to see that JDOM is being officially released soon. Mo=<br>
> reover, it features new capabilities like Content class that will make =<br>
> our work easier!<br>
><br>
> I still have just one concern with the API, that forces us to provide o=<br>
> ur own build to customers. It's about optimization, when you want to co=<br>
> nstruct a DOM without going through any validation stuff, because you p=<br>
> erfectly know that your DOM is valid. Typically, we currently do this w=<br>
> hen building an HTML tree programmatically (the build class is machine =<br>
> generated from HTML source). <br>
> We already spoke about this earlier, and I want to reanimate the debate=<br>
> because it may gain up to 20/25% execution speed. <br>
><br>
> You'll find a copy of the changes I made and now working with Beta 9 in=<br>
> production. To please Eliott and prevent people from doing something b=<br>
> ad, all these &quot;unverified&quot; methods must be called as static m=<br>
> ethods from UnverifiedFactory class. I joined to the mail the pieces of=<br>
> code that does the trick. Nothing changed in the API, it is just an a=<br>
> dd-on.. Because of class scopes, there is now way to make it running wi=<br>
> thout providing a custom build. <br>
<br>
Jason just moved JDOMFactory out of package org.jdom.input and into<br>
org.jdom so users can have a custom factory to skip verification from<br>
trusted sources, so that pretty much eliminates the need for the extra<br>
createElement, etc. methods. And since it has moved, putting a "fast"<br>
version of JDOMFactory in contrib would probably be a good idea at this<br>
point.<br>
<br>
But I don't see how the static addContent methods help. Elements can have<br>
anything as children except a DocType so all your skipping is one instanceof<br>
test and a check for a null parent. But the potentially biggest time waster,<br>
reallocation of the content array, remains intact. But that assumes the<br>
number of children in most of a document's elements greatly exceeds the<br>
INITIAL_ARRAY_SIZE and causes excessive array reallocation. Something only<br>
profiling can support or disprove, and then only on a case by case bases.<br>
<br>
One problem I do see, which falls under the TODO item "ensure JDOM is<br>
appropriately tweaked for subclassing", is if your problem would benefit<br>
from a larger INITIAL_ARRAY_SIZE, I don't see a easy to do it currently.<br>
<br>
Brad<br>
------------------------------------------------------------<br>
Mail was checked for spam by the Freeware Edition of No Spam Today!<br>
The Freeware Edition is free for personal and non-commercial use.<br>
You can remove this notice by purchasing a full license! To order<br>
or to find out more please visit: </tt><tt><a href="http://www.no-spam-today.com">http://www.no-spam-today.com</a></tt><tt><br>
</tt>
</body></html>