开发者

XSLT Transforming performance

Here is links to my files XML, XSLT, Include XSLT

Hi

I am transforming xml into html. My xml file is about 10kb big and my xslt 70kb and output html about 10kb big.

Transformer xformer = StylesheetCache.newTransformer(templateFile);
xformer.transform(new DOMSource(outlineDoc),new StreamResult(out));

The creating of the transformer takes about 10s to create thats why i created cache that bring it down to 300ms if its cached. The transform line takes 3s to execute. Now is this long. I have written similar开发者_C百科 transforms on windows mobile and it execution time is about <=1s

I changed the TransformerFactory to Saxon but the result was about the same.

thanks


You problem is with use of DOMSource, don't use it if at all possible. Saxon specifically has much worse performance compared to using a streaming source or SAX source -- this because it builds its own highly optimized (for xslt use) tree ("tiny tree"). There is a work-around to this problem as well as full explanation at: http://dev.saxonica.com/blog/mike/2007/03/#000138.

But even if you were using Xalan (JDK default), it makes sense to use raw input and not build intermediate DOM structure; XSLT processors can build optimal in-memory representation themselves and often more efficiently.


I found the problem... I think i need to kick myself. I was at home playing with my phone so i decided to play with the app a bit. and all of a sudden the init load was like 1s and subsequent calls like 500ms. So at this point i was stumped. i so pulled out my laptop plugged my phone in and debugged and all of a suddend it was 12s again. i was the freaking IDE. as soon as i run it through ecclipse it slows down to 12s.

:-\


Are you experiencing such delays on each transformation? I've noticed that when it takes a while for Android to load the third-party libraries into the process. The exact time depends on the library size. For example loading joda-time takes approximately 3 seconds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜