You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by jo...@us.ibm.com on 2001/12/18 02:28:51 UTC

DOM performance question

1) I'm groveling through the Xalan code, looking for performance
bottlenecks, and I've noticed something a bit odd. Most of the DOM
operations which get a value from a node -- getNodeName, getNodeType, etc.
-- are returning in a relatively small number of ticks. JProbe reports the
"line time" for these as averaging around 20-30; I think the unit is ms of
CPU time.

A getNamespaceURI() call on the same node is taking significantly longer --
141 units. A small delta, perhaps, but surprising -- and this occurs in one
of Xalan's inner loops, as we generate a DTM proxy for the DOM.

If anyone has an idea for why the Xerces DOM would be slower on this
operation than the others, it might be worth investigating.

This is with Xerces1; I haven't yet started performance testing against
Xerces2, though I suppose I should.



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: DOM performance question

Posted by Arnaud Le Hors <le...@us.ibm.com>.
joseph_kesselman@us.ibm.com wrote:
> 
> 1) I'm groveling through the Xalan code, looking for performance
> bottlenecks, and I've noticed something a bit odd. Most of the DOM
> operations which get a value from a node -- getNodeName, getNodeType, etc.
> -- are returning in a relatively small number of ticks. JProbe reports the
> "line time" for these as averaging around 20-30; I think the unit is ms of
> CPU time.
> 
> A getNamespaceURI() call on the same node is taking significantly longer --
> 141 units. A small delta, perhaps, but surprising -- and this occurs in one
> of Xalan's inner loops, as we generate a DTM proxy for the DOM.
> 
> If anyone has an idea for why the Xerces DOM would be slower on this
> operation than the others, it might be worth investigating.

Here is the typical code used for those methods:

    public String getNodeName() {
        if (needsSyncData()) {
            synchronizeData();
        }
        return name;
    }

    public String getNamespaceURI() {
        if (needsSyncData()) {
            synchronizeData();
        }
        return namespaceURI;
    }

As you can see there are not really different. However, on the first
call the data is synchronized (converted from the deferred DOM internal
data to the DOM). This only applies if you use the Deferred DOM, but if
you do (it's the default) and in your test you always call
getNamespaceURI() first, there is no doubt it will always take more
time.

> This is with Xerces1; I haven't yet started performance testing against
> Xerces2, though I suppose I should.

There is no difference there. The DOM implementation is the same in
both.
-- 
Arnaud  Le Hors - IBM, XML Standards Strategy Group / W3C AC Rep.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org