You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Sc...@lotus.com on 2001/02/09 18:31:54 UTC

Re: What's the fastest way to do transformation?

> What I
> got is not good enough( 2 sec/initialization, 50~150 sec/100 times).

In general, performance is not "good enough" yet.  We have some work to do.

> Will there be any difference, if I use StreamResult instead
> of DOMResult?

Yes.

> Can anyone give some suggestions about how to improve the performance,
> please? Like what kind of xsl elements should be avoided, something can
> be done to this code, ...

Avoid "//" patterns near the top of the tree.  Avoid use of last() when you
can.  Beyond this, write good structured xsl stylesheets, and be a little
patient for the technology to improve.  And submit your stylesheets for
inclusion in our test suite... which will help us identify peformance
bottlenecks for real-world cases.

-scott




                                                                                                                   
                    Guoliang Cao                                                                                   
                    <cao@ispsoft.        To:     "xalan-dev@xml.apache.org" <xa...@xml.apache.org>             
                    com>                 cc:     (bcc: Scott Boag/CAM/Lotus)                                       
                                         Subject:     What's the fastest way to do transformation?                 
                    02/09/2001                                                                                     
                    11:52 AM                                                                                       
                    Please                                                                                         
                    respond to                                                                                     
                    xalan-dev                                                                                      
                                                                                                                   
                                                                                                                   




Hello,

I'm using this code to measure the transformation performance. What I
got is not good enough( 2 sec/initialization, 50~150 sec/100 times). The
xsl file is 150KB, the xml file is < 1KB.  The template depth is about 5
- 6 level.

As I remember, this simple sample code is using SAXParser, and should be
optimized. Will there be any difference, if I use StreamResult instead
of DOMResult?

Can anyone give some suggestions about how to improve the performance,
please? Like what kind of xsl elements should be avoided, something can
be done to this code, ...

Comments appreciated!

Guoliang


TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer =
tFactory.newTransformer(newStreamSource("/Test.xsl"));
Document doc = new DocumentImpl();

long start = System.currentTimeMillis();
for (int i=0; i<100; i++)
transformer.transform(StreamSource("/Test1.xml"), new DOMResult(doc));
System.out.println("Total time for 100 transformation
is:"+String.valueOf((System.currentTimeMillis() - start)/1000));