Joseph, In fact current implementation DTMDefaultBase creates m_elemIndexes even if indexing is turned off. DOM2DTM.addNode calls indexNode without any condition, and the same occurs in DTMDefaultBase.indexNode (no condition).
So I have added condition to DTMDefaultBase.indexNode as well, as change you suggested. The improvement in speed is not very big (<8% as shown by OptimizeIt, but it with classic JVM, probably hotspot gains will be less than this). Plus the amount of allocated memory reduced significally. I'm not sure if it affects many/small amount stylesheets, but on first look DOM2DTM class calls only getFirstChild, getNextSibling to traverse document, and these functions seems like never indexed anyway. So, it may happen that any transform with DOMSource do unnecessary indexing. Sorry, but my xalan knowledge is not really big, so my suggestions can be wrong. Pavel > -----Original Message----- > From: Joseph Kesselman [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, September 17, 2002 5:57 PM > To: [EMAIL PROTECTED] > Subject: Re: Why do indexing? > > > 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 >
