<html><body>
<p>As desired by Jason, I did some performance testing using an "UnverifiedFactory" which bypasses all validation code (object creation, addition to lists...). To prevent a user from using it inadvertently, all these methods are defined in a dedicated factory, accessing package-protected object data members.<br>
<br>
This new class should be added to org.jdom, and both ContentList & AttributeList should be modified (2 package-protected methods added).<br>
<br>
Another implementation using inherited classes can be provided but this does not solve the list access unverified methods, as there is currently no solution to handle this concern without being in the same package.<br>
<br>
<br>
I did 3 tests scenarios:<br>
<br>
1/ Online java code<br>
Our product (flowbuilder, <a href="http://xsp.triloggroup.com">http://xsp.triloggroup.com</a>) generates one java class per HTML page, which creates a JDOM document from the actual HTML file. This is similar, on some aspects, to XMLC.<br>
I then generated 2 classes from a real travel expenses application (see .jpg screen copy), one using the unverified factory and the other standard JDOM calls.<br>
<br>
2/ SAX Builder<br>
This is certainly the most common way to build a JDOM from a text. For our testing purposes, I created 2 new classes SAXBuilderUnverified & SAXHandlerUnverified, whose are mainly copies of original classes but use the Unverified factory to build the document. These classes should be temporarily added to org.jdom.input package.<br>
Of course these classes are for performance testing only, and integrating them to JDOM furniture needs some refactoring of JDOMFactory.<br>
<br>
3/ XMLS<br>
I took Denis Sosnoski's classes and added a new JDomInputUnverified class, which should be added to com.sosnoski.xmls package.<br>
<br>
<br>
<br>
Measuring the results.<br>
----------------------<br>
I created 3 test files in a jdomtest package: TestHTML, TestSAX & TestXMLS, one per test case. You can run these test files to get your own set of results.<br>
<br>
Note that java only provides System.currentTimeMillis() which is both not accurate and do not measure real CPU time used but time elapsed. For this reason, I'm calling a proprietary class which uses native windows code (Win32::GetProcessTimes) to actually measure the CPU time consumed (kernel+user). I cannot, unfortunatly, give the source code for this routine. But the results returned are very closed to the one got with a profiler (I compared to OptimizeIt).<br>
For this reason, re-run tests can return slightly different results with call to System.currentTimeMillis(), as this does not remove the time consumed by other applications within the system! Typically, percentages are decreased by a factor of 3 on my machine...<br>
<br>
Here are the results I measured, running from JBuilder 9, on my Dell Inspiron 8200.<br>
<br>
<br>
=========================================================================<br>
TEST HTML CREATIONResults for 5000 loops:<br>
Normal=9194ms<br>
Unverified=2153ms<br>
=>327,03%<br>
<br>
<br>
=========================================================================<br>
TEST SAX<br>
<br>
CHECKING FILE:/jdomtest/periodic.xml<br>
Read XML=7420ms<br>
Read XML Unverified=5358ms<br>
=>38,48%<br>
<br>
CHECKING FILE:/jdomtest/much_ado.xml<br>
Read XML=10695ms<br>
Read XML Unverified=7802ms<br>
=>37,08%<br>
<br>
CHECKING FILE:/jdomtest/soap1.xml<br>
Read XML=10365ms<br>
Read XML Unverified=9553ms<br>
=>8,5%<br>
<br>
CHECKING FILE:/jdomtest/soap2.xml<br>
Read XML=13580ms<br>
Read XML Unverified=11096ms<br>
=>22,39%<br>
<br>
CHECKING FILE:/jdomtest/xml.xml<br>
Read XML=12158ms<br>
Read XML Unverified=9103ms<br>
=>33,56%<br>
<br>
<br>
=========================================================================<br>
TEST XMLS<br>
<br>
CHECKING FILE:/jdomtest/periodic.xml<br>
Read XML=3084ms<br>
Read XML Unverified=2424ms<br>
=>27,23%<br>
<br>
CHECKING FILE:/jdomtest/much_ado.xml<br>
Read XML=5698ms<br>
Read XML Unverified=4807ms<br>
=>18,54%<br>
<br>
CHECKING FILE:/jdomtest/soap1.xml<br>
Read XML=290ms<br>
Read XML Unverified=241ms<br>
=>20,33%<br>
<br>
CHECKING FILE:/jdomtest/soap2.xml<br>
Read XML=4126ms<br>
Read XML Unverified=3194ms<br>
=>29,18%<br>
<br>
<br>
In my opignon, results are significant enough to justify an add-on to JDOM. At least, if JDOM does not offer this capability, we should be able to add it using inherited classes. But, unfortunatly, this is not currently possible because of List protected class & methods. Giving fastAdd...() methods solves the problem.<br>
<br>
Phil.<br>
<br>
<i>(See attached file: jdom_unverified.zip)</i></body></html>