axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <>
Subject Re: FYI : JDOM vs. DOM
Date Tue, 03 Apr 2001 18:30:13 GMT wrote:

> With JDOM, the first run took 16ms.  The next 9 were all the same, 0ms.

that is pretty blazing speed (0ms?) so i got very curious here are snippets from your code:

     try {
            DOMParserWrapper parser =
            DOMCount counter = new DOMCount();
            long before = System.currentTimeMillis();
            parser.setFeature( "",

                               setDeferredDOM );
            parser.setFeature( "",
                               setValidation );
            parser.setFeature( "",
                               setNameSpaces );
            parser.setFeature( "",
                               setSchemaSupport );

            Document document = parser.parse(uri);
            long after = System.currentTimeMillis();
            counter.printResults(uri, after - before);
        } catch (org.xml.sax.SAXParseException spe) {

so in DOM case you measure Document tree creation (parser.parse(uri)) _and_ traversing

        try {
            SAXBuilder builder = new SAXBuilder();
            Document document =;
            JDOMCount counter = new JDOMCount();
            long before = System.currentTimeMillis();

            long after = System.currentTimeMillis();
            counter.printResults(uri, after - before);
        } catch (Exception e) {

however for JDOM you have excluded Document tree creation from time measuring (Document document
= and only included (counter.traverse(document.getRootElement());).

so i would say walking _already_ constructed tree of 4 elements should be pretty fast (and
guess as well for DOM...).


Aleksander Slominski, LH 316, IU,
As I look afar I see neither cherry Nor tinted leaves Just a modest hut
on the coast In the dusk of Autumn nightfall - Fujiwara no Teika (1162-1241)

View raw message