You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Pavel Ausianik <Pa...@epam.com> on 2002/09/17 15:43:08 UTC

Why do indexing?

Hello,

My application is doing a lot xslt  transformations using xalan, mostly via
Transformer.transform(DOMSource, DOMResult).
While investigating  why transformation consumes so much memory I have found
that noticable amount of  Object[] and int[] has been allocated below the
method DTMDefaultBase.indexNode (next call is ensureSizeofIndex()). Further
investigations show that the only method, which can use the indexes is
method DTMDefaultBase.findElementFromIndex(), and it is never called in my
scenario. So my question is - how to avoid unnecessary indexing?

Does it makes sence for me spending time on improving this object?

Best regards,
Pavel Ausianik

Re: Why do indexing?

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Indexing yields a performance improvement in some stylesheets, by reducing 
the amount of tree-walking needed to find elements by name. But it does 
have some computational/storage cost, and some stylesheets won't benefit 
from it. As with any optimization, we're playing the odds...

Internally, indexing can be turned on or off when the DTM is requested 
from the DTMManager -- we don't attempt to index RTFs, for example, since 
they're usually small enough (and transient enough) that the cost of 
indexing would outweigh the gain. But I don't think we've exposed any way 
to control that via the user APIs; it appears to be hardcoded in the 
Transformer.transform() call.

If you want to experiment with it and see whether exposing this control 
would be useful, the patch point is in the Transformer.transform() method, 
where it calls 
      DTM dtm = mgr.getDTM(source, false, this, true, true);
Changing that to 
      DTM dtm = mgr.getDTM(source, false, this, true, false);
would turn off indexing.

If that does turn out to be significantly helpful for a significant number 
of stylesheets, we should probably post  an Enhancement request in 
Bugzilla suggesting that a feature be created to control this.

______________________________________
Joe Kesselman  / IBM Research