You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Guoliang Cao <ca...@ispsoft.com> on 2001/02/09 17:52:34 UTC

What's the fastest way to do transformation?

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));