You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by La...@WellsFargo.COM on 2002/12/24 01:47:35 UTC

Reducing XML transformation time

Dear All:

I am trying to reduce the time taken for transforming XML into HTML using
XSL. Here is what I have done so far:

1. Reducing the size of XML document.

- The original size of XML document was around 2500 lines. I reduced the
size of XML document by constructing new DOM and passed this DOM to the
transformation method. (I could do this by constructing DOM of only those
nodes that are required in the current transformation.) The new XML
document's size is around 200 lines. This gave me a pretty good performance
improvement. Originally, it took around 3000 miliseconds for transformation.
With new DOM object passed to the process() method, it takes around 300 -
400 ms. 

2. Replacing // in XSL code

- I replaced all the occurance of // (descendant axes) in XSL code with
absolute path and this gave me some improvement in the transformation time.

I see that the bare minimum time taken for transformation is around 300 ms.
My question is -- Is there anything else I can do to reduce this
transformation time .. My goal is to reduce the transformation time to
around 75 - 100 ms. 

Please note that I am using Xalan 1.0.1 and Xerces 1.0.3.

Any help in this will be highly appreciated!!

Thanks much.
Kaushik.

Re: Reducing XML transformation time

Posted by Peter Davis <pd...@pdavis.cx>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 23 December 2002 16:47, Lahoti.Kaushik@WellsFargo.COM wrote:
> constructing new DOM and passed this DOM to the
> transformation method.

If you can, avoid using a DOM altogether and use SAX instead; at least for the 
input.  I assume you are creating your DOM from an actual XML file since you 
refer to the number of "lines", so using SAX input should work unless you do 
some other pre-processing, which maybe you can or should avoid as well.

Xalan uses a custom "DTM" data model which it creates directly from SAX 
streams, but for DOMs it must create a "DTM wrapper" which cannot be as 
efficiently optimized and which creates another layer of innefficiency.

- -- 
Peter Davis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+CC5xhDAgUT1yirARAus+AJ427fQcUcobSlOdy6P83nRWT77qZgCeP3Wd
sW9/XZQH7QFlJ7JCf8OBCW0=
=YqZZ
-----END PGP SIGNATURE-----


Re: Reducing XML transformation time

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Upgrading to a newer version of Xalan and Xerces might be worth 
considering. 1.0.1 is pretty darned ancient, and we've done some work on 
processor performance since then. (And on conformance, which usually isn't 
free and is why I say "might".)

BUT: Please note that some of the changes we made to improve SAX 
performance in more recent versionf of Xalan. had adverse effects on DOM 
performance. Prefiltering the document might or might not still be 
helpful, but for now I'd recommend that you do that via a SAX filter 
rather than by building and editing a DOM, if at all possible. We do have 
some thoughts on changes that might bring our DOM performance back up, but 
they're still speculative.

______________________________________
Joe Kesselman  / IBM Research